Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What permissions are needed for SQLDependency?

What permissions are needed for using SQLDependency? I checked books online but it wasn't clear on this point.

like image 747
Jonathan Allen Avatar asked Jul 08 '14 07:07

Jonathan Allen


2 Answers

This works:

CREATE SCHEMA sql_dependency_user --empty placeholder schema
GO
CREATE LOGIN TEST_USER WITH PASSWORD=N'XXX', DEFAULT_DATABASE=[TestDatabase], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO
CREATE USER TEST_USER FOR LOGIN TEST_USER
WITH DEFAULT_SCHEMA=[sql_dependency_user]
GO
GRANT CREATE PROCEDURE TO TEST_USER
GO
GRANT CONTROL ON SCHEMA::[sql_dependency_user] TO TEST_USER
GO
GRANT CREATE SERVICE TO TEST_USER
GO
GRANT CREATE QUEUE TO TEST_USER
GO
GRANT IMPERSONATE ON USER::dbo TO TEST_USER
GO
GRANT REFERENCES ON CONTRACT::[http://schemas.microsoft.com/SQL/Notifications/PostQueryNotification] TO TEST_USER
GO
GRANT SUBSCRIBE QUERY NOTIFICATIONS TO TEST_USER;
GO
GRANT SELECT ON SCHEMA::[dbo] TO TEST_USER
GO
GRANT RECEIVE on QueryNotificationErrorsQueue TO TEST_USER

I am not marking it as the answer yet because I don't know for a fact that all of those permissions are needed.

like image 66
Jonathan Allen Avatar answered Oct 21 '22 23:10

Jonathan Allen


As far as I know, the user must have ALTER permission, and in addition, you have to enable SERVICE BROKER

GRANT ALTER ON SCHEMA::dbo to myUser 

ALTER DATABASE myDatabases SET ENABLE_BROKER;
like image 2
apomene Avatar answered Oct 21 '22 23:10

apomene