snippetsqlModerate
How do query notifications detect changes in the query result?
Viewed 0 times
resultthequerynotificationschangeshowdetect
Problem
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
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?
While running a server-side trace for an unrelated issue, I noticed the query
SELECT color FROM ColorListwas 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?
Solution
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
The projected columns in the SELECT statement must be explicitly
stated, and table names must be qualified with two-part names.
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.
Context
StackExchange Database Administrators Q#14691, answer score: 10
Revisions (0)
No revisions yet.