The query notifications functionality builds on the change detection mechanisms that the Database Engine uses to maintain indexed views. The requirements and restrictions for statements in a query for notification are similar to the requirements and restrictions for an indexed view.
When a SELECT statement is executed under a notification request, the connection that submits the request must have the options for the connection set as follows:
If these options are not set appropriately, the notification is fired immediately after the SELECT statement is executed. When a notification is active, the connection that issues a command that causes a notification to fire must also have the SET options set as shown. Otherwise, the command fails with a Transact-SQL error.
When the statement is contained in a stored procedure, the ANSI_NULLS option and the QUOTED_IDENTIFIER option must be set when the stored procedure is created. For more information, see SET ANSI_NULLS (Transact-SQL) and SET QUOTED_IDENTIFIER (Transact-SQL).
In general, you can request notification for any query that can be used to create an indexed view. You can set up notifications for the following statements:
When a command that registers a notification contains more than one statement, the Database Engine creates a notification for each statement in the batch.
Query notifications are supported for SELECT statements that meet the following requirements:
If a subscription request is made for a batch or stored procedure, a separate subscription request is made for each statement executed within the batch or stored procedure.
EXECUTE statements will not register a notification, but will flow the notification request to the executed command. If it is a batch, the context will be applied to the executed statements and the same rules described above apply.
Submitting a duplicate of an active subscription causes the existing subscription to be renewed using the new specified time-out value. A duplicate subscription is one that meets the following conditions:
This means that if a notification is requested for identical queries, only one notification is sent. This applies to a query duplicated in a batch, or to a query in a stored procedure that is called multiple times.
Although the article mentions that queries that form the basis of notifications can not contain Outer and Self Joins it seems to leave open the possibility that simple Inner Joins should be possible.
Unfortunately this doesn't appear to be the case. The extremely simple case shown below will result in numerous notifications being fired over and over again.
It seems as though query notification will only work if you are using very trivial Select statements referencing exactly one table.
SELECT dbo.TableA.ID
FROMdbo.TableB
INNER JOIN tblTrafficDesksON TableA.ID= TableB.ID
Also, see this blog post: http://www.thedatafarm.com/blog/2005/11/06/VS2005SQLServer2005RTMQueryNotificationRules.aspx Note that the author says "the select list must contain a COUNT_BIG(*)"