Tarun Pothulapati
Tarun Pothulapati

Reputation: 572

Azure Table Storage Rowkey Query not returning correct entities

I have an azure table storage with a lot of entities and when I query for entities with Rowkey(which is of the data type "Double") less than 8888 by using the query "RowKey le '8888' ".I get also those entities with Rowkey greater than 8888 also.

storage query

Upvotes: 1

Views: 341

Answers (1)

Gaurav Mantri
Gaurav Mantri

Reputation: 136366

Even if you are storing a Double data type in RowKey, it gets stored as a String (both PartitionKey and RowKey are string data type). Thus the behavior you are seeing is correct because in string comparison 21086 is smaller than 8888.

What you need to do is make both of these strings of equal length by pre-padding them with 0 (so your RowKey values will be 000021086 and 000008888 for example) and then when you perform your query, these values will not be returned.

Upvotes: 6

Related Questions