使用SQLDependency需要哪些权限?我上网查了一下,但这一点不是很清楚。
这行得通:
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
我还没有将其标记为答案,因为我不知道是否需要所有这些权限
据我所知,用户必须具有ALTER
权限,此外,您必须启用SERVICE BROKER
GRANT ALTER ON SCHEMA::dbo to myUser
ALTER DATABASE myDatabases SET ENABLE_BROKER;