Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

T-SQL How to grant role to user

People also ask

How do I grant a role to a user in SQL?

Right-click the role you want to edit and select Properties. In the Database Role Properties -database_role_name dialog box, in the General page, click Add. In the Select Database User or Role dialog box, under Enter the object names to select (examples), enter the login or database role to add to this database role.

How do you grant a role to a user?

The syntax to grant a role to a user in Oracle is: GRANT role_name TO user_name; role_name. The name of the role that you wish to grant.

How do I grant permission to run a role in SQL Server?

Use SQL Server Management StudioExpand Stored Procedures, right-click the procedure to grant permissions on, and then select Properties. From Stored Procedure Properties, select the Permissions page. To grant permissions to a user, database role, or application role, select Search.


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>

EXEC sp_addrolemember 'db_owner', 'JohnJacobs'