After creating roles and granting privileges to them, I want to grant the privileges of a specified role to a user, how to do with it? I tried grant to , but failed.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
EXEC sp_addrolemember 'db_owner', 'JohnJacobs'
回答2:
Because BOL shows sp_addrolemember has been deprecated, if you are using SQL Server 2012 you may want to use:
ALTER ROLE <role_name> ADD MEMBER <user_name>