<< Back To All Blogs
Querying Table Entities with Microsoft Azure (And ADO.NET Data Services Framework)
Thursday, November 6th, 2008
I have been doing a lot of work lately with Microsoft Azure and specifically with the Tables in Microsoft Azure. During my work with the tables I was unable to find any up-front, easy to use examples of "queries" for entities in tables (otherwise known as filters by Azure terms). Here are some common rules which are important to know followed by some very basic examples of queries.
Most important: strings are enclosed in single quotes.
Sub-queries (aka sub-filters) are enclosed in single parenthesis ( and ).
Sub-queries are and'd and or'd outside and between parenthesis.
Comparisons are used as short-handed English-variant operators, such as ge for Greater then or equal to (>=), ne for Not equal to (!= or <>), and so on.
Without further ado, here are some examples:
Rows where the firstname column is equal to "tom":
$filter=(firstname eq 'tom')
Rows where the firstname column is not equal to "tom":
$filter=(firstname ne 'tom')
Rows where the counter column is greater then 5:
$filter=(counter gt 5)
Rows where the counter column is greater then 5 and less then 15:
$filter=(counter gt 5)and(counter lt 15)
Rows where the counter is greater then 20 or less then 10:
$filter=(counter gt 20)or(counter lt 10)
The same query syntax should also be useable with ADO.NET Data Services Framework although I have not confirmed this as of yet.
$filter=(blog eq 'Tom Out')
Creating an MD5 String Extension method in C#
ASP.NET Best Practices
Enumerating the values of an enum in C#
Updating an LDAP Property in C#
Currently no comments.
Add A Comment
Email Address: (not public, used to send notifications on further comments)
Enter the text above, except for the 1st and last character: