Is there a way to to get notifications when SQL Azure data changes or when new data is inserted? I would like to send notifications to an ASP.NET web application and push notifications to a Windows Phone. I know that the SqlDependency class and Query notifications are used to monitor SQL Server 2008 database data changes but SQL Azure doesn't support this yet.
问题:
回答1:
Sorry but you don't have any options available other than rolling your own notification mechanism. One of the ways you could do this is to create triggers on the table you want to monitor and test for field-level updates, store the event in a secondary table, and code your application to read those events on a specific frequency. The COLUMNS_UPDATED function can help you figure out which fields were changed inside a trigger.
回答2:
One option that might work for you is to use a cron service like Aditi Scheduler. The way you might achieve this is to have some service URL that when called makes a call to your SQL Azure db to detect if new data is inserted and then send the notification when there is new data. You would then configure the Aditi scheduler to call this service endpoint say every 10 min. The Aditi scheduler would be free (I believe) if you use it to call your service no more frequently than every 10 min.