While running a query in Azure based on the last updated time (I had a DateTime field in my table), I was not getting the results I expected. I had rows whose last updated time was over an hour ago, and I was running a query that would return all records over an hour old, but I wasn’t getting those rows back.
The problem was that I was using a GETDATE() call in the stored procedure, which was in SQL Azure. However, the time that I was using to pull the records was in my local development environment. The time on the Azure site were quite different than on my system.
There are a couple ways to solve this. Using UTC time is one way. Consistently using the GETDATE() call so that it is used in the same environment is another. (Calling the function only on the SQL Azure database, or passing in a DateTime from an application as a parameter to a stored procedure.) I went with the latter, and it worked fine. Just something to keep in mind.