
For more information about supported property types, see Understanding the Table Service Data Model.īe sure to check whether a property has been explicitly typed before assuming it is of a type other than string. The constant value must be of the same data type as the property in order for the filter to return valid results. A space is URL-encoded as %20.Īll parts of the filter string are case-sensitive. The property name, operator, and constant value must be separated by URL-encoded spaces. Note that it is not possible to compare a property to a dynamic value one side of the expression must be a constant. Use the logical operators defined by the OData Protocol Specification to compare a property to a value. When constructing a filter string, keep these rules in mind: Both the PartitionKey and RowKey properties are of type String. Note that the key property names and constant values are case-sensitive.

The following example returns the top 10 entities from a table named Customers: ()?$top=10įiltering on the PartitionKey and RowKey Propertiesīecause the PartitionKey and RowKey properties form an entity's primary key, you can use a special syntax to identify the entity, as follows: (PartitionKey='MyPartition',RowKey='MyRowKey1')Īlternatively, you can specify these properties as part of the $filter option, as shown in the following section. To return the top n entities for any query, specify the $top query option. Note that both the $top and $filter options can be used to filter on table names as well, using the syntax demonstrated for filtering on properties of type String. For more information, see Writing LINQ Queries Against the Table Service. The same queries could be written using LINQ syntax.
#AZURE TABLE QUERY TIMESTAMP HOW TO#
The following samples show how to construct the request URI for some typical entity queries using REST syntax. For example, "o'clock" would be: o''clock Single quotes in query strings must be represented as two consecutive single quotes ( ''). The following characters must be encoded if they are to be used in a query string: Within a $filter clause, you can use comparison operators to specify the criteria against which to filter the query results.įor all property types, the following comparison operators are supported: OperatorĪdditionally, the following operators are supported for Boolean properties: Operatorįor more information about filter syntax, see the OData Protocol Specification. Note that the $top query option in the case where results are paginated specifies the maximum number of results per page, not the maximum number of results in the whole response set.Īdditional query options defined by OData are not supported by the Table service.

See Query Timeout and Pagination for additional information. Otherwise your subsequent requests may return unexpected results. For example, if you have specified a $filter, $select, or $top query option as part of the original request, you will want to include that option on subsequent requests. When making subsequent requests that include continuation tokens, be sure to pass the original URI on the request. You can specify additional options to limit the set of tables or entities returned, as described in the following Supported Query Options section.Ī request that returns more than the default maximum or specified maximum number of results returns a continuation token for performing pagination. Ordering results in any other way is not currently supported. Query results are sorted by PartitionKey, then by RowKey. To return all entities in a table, specify the table name on the URI, without the Tables resource: () To return a single named table, specify that table as follows: ('MyTable') The basic URI for addressing the Tables resource is as follows:


To return all of the tables in a given storage account, perform a GET operation on the Tables resource, as described in the Query Tables operation. The following sections describe query options and demonstrate some common scenarios. Querying tables and entities in the Table service requires careful construction of the request URI.
