T-SQL How to grant role to user

前端 未结 2 1424
孤城傲影
孤城傲影 2020-12-28 11:43

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.

相关标签:
2条回答
  • 2020-12-28 12:23
    EXEC sp_addrolemember 'db_owner', 'JohnJacobs'
    
    0 讨论(0)
  • 2020-12-28 12:30

    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>
    
    0 讨论(0)
提交回复
热议问题