Sunday, February 26, 2012

Event Notification Syntax Error

Hi

I have a simple question regarding event notification in sql 2005. I keep up getting a message indicating a syntax error when trying to execute the following script. I also tried with [ instead of '.

CREATE EVENT NOTIFICATION NotifyCT
ON DATABASE
FOR CREATE_TABLE
TO SERVICE 'NotifyService'

Msg 102, Level 15, State 1, Line 4
Incorrect syntax near 'NotifyService'.

I cannot find any error in my syntax. Please help

Thanks

You need to specify the broker instance for the service. Ex:

CREATE EVENT NOTIFICATION NotifyCT
ON DATABASE
FOR CREATE_TABLE
TO SERVICE 'NotifyService', '<broker_instance_guid>'

-- or

CREATE EVENT NOTIFICATION NotifyCT
ON DATABASE
FOR CREATE_TABLE
TO SERVICE 'NotifyService', 'current database'

See Books Online "CREATE EVENT NOTIFICATION" topic for more details.

No comments:

Post a Comment