T-SQL How to grant role to user

sql-server, sql-server-2008, t-sql

Solution

EXEC sp_addrolemember 'db_owner', 'JohnJacobs'

Just to let people in the future know, MS official documentation now specifies that this approach is being deprecated. ALTER ROLE is recommended intead.

Problem

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.

Original source