Sql-server – T-SQL How to grant role to user

sql-serversql-server-2008tsql

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.

Best Solution

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>