Hi all,
I have an issue with query notifications whereby the notifications stop being sent for specific query templates. For example, I may have:
SELECT [dbo].[column1] FROM [dbo].[table1]
which suddenly stops getting notifications. By that I mean, I have a test console application that creates a SqlDependency with that command, modify the table, and the OnChanged event is not called. When I change my query to:
SELECT [dbo].[column1], [dbo].[column2] FROM [dbo].[table1]
or almost any modification to the command text (i.e. adding a where clause, adding/removing columns), it works perfectly.
Restarting SQL, killing subscriptions, deleting queues/services manually, nothing makes any difference. Once a query "stops working," I've never been able to have it work again.
It's incredibly frustrating and the information on the internals of this is absolutely lacklustre. I can't work out how to clear query templates, so it constantly reuses the same template, thus the same subscription "table."
I tend to believe, if I could destroy these internal query templates, it would remedy the problem, although I have no idea why it occurred in the first place.
It seems to occur only after a long period of time after I have opened many notifications using the same query template.
I am using SQL Server 2012 RTM.
Any help would be really appreciated.