Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SQL Statment to change user permissions?

Author  Topic 

Eagle_f90
Constraint Violating Yak Guru

424 Posts

Posted - 2009-01-15 : 17:26:06
I have been looking through books online but can't find anything that looks like it applies. What I want to do is map a user to a DB and then set the role for that user as db_datareader. Is there a proc for this I can call or what is the SQL command? I found the grant command in books online but either I am not understanding it right or it does not apply.

--
If I get used to envying others...
Those things about my self I pride will slowly fade away.
-Stellvia

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-01-15 : 17:28:56
Check out sp_grantdbaccess and sp_addrolemember in BOL.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2009-01-15 : 20:08:28
If you know how to do this using SSMS graphical user interface (or for that matter anything else that you may want to do), you can use the script feature of SSMS to see the script that is required to do the task. The Script button is located near the top left of the pop up window. After making all the changes you want to do - for example granting the db_datareader role to the user - don't click the OK button, instead, click the Script button.
Go to Top of Page
   

- Advertisement -