I am working with a legacy database that has implemented query notifications against a table called ColorList.

While running a server-side trace for an unrelated issue, I noticed the query

SELECT color FROM ColorList

was being executed every 10 milliseconds.

Is this how Query Notification works? Does SQL Server store the results of the original query and then run the query endlessly until it detects a change?

  • Don't get to used to using notification services. It's only available in SQL Server 2005. – mrdenny Mar 9 '12 at 19:33

Read the Mysterious Notification for an explanation on how it works. If you see the query executed every 10ms it means your application is running it every 10ms. My 8 ball is telling me your code does not check the notification EventArgs and is blindly resubmitting the query despite the Info being of the value Invalid, indicating a query than cannot be notified. Which is to be expected, since your query does not conform to the Query Notification restrictions:

The projected columns in the SELECT statement must be explicitly stated, and table names must be qualified with two-part names.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.