SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


creating new users and granting permissions


creating new users and granting permissions

Author
Message
Jpotucek
Jpotucek
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1570 Visits: 1677
I know that I can do this to add a new NT User to the Database and grant them access to a specific Database


--Add NT UserID to SQL Server
Use ChangeMgmt
EXEC sp_grantlogin 'Domain\UserID'
GO

--Grant Access to ChangeMgmt Database
Use ChangeMgmt
EXEC sp_grantdbaccess 'Domain\UserID, 'Domain\UserID'
GO



but I can't figure out how to take it one step further and grant the user specific permissions in the Database??!!



Steve Jones
Steve Jones
SSC Guru
SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)

Group: Administrators
Points: 62795 Visits: 19111
Create a role, add the user to the role.

Grant permissions to the role with GRANT SELECT on MyTable to MyRole. Use appropriate permissions for your role.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Jpotucek
Jpotucek
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1570 Visits: 1677
Thank you so much Steve!! I'm in a new position and kind of a newbie too.. The DBA Before me granted permissions to a particular Database individually. If I look in logins under the Security tab in Ent Manager, there are like 40 users - all with the same permissions to ONE Database. I'm thinking that I can create the role and then drop all of the individual permissions.. is that right?



Jpotucek
Jpotucek
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1570 Visits: 1677
Still kind of confused on this.

After I create the Role and give the role appropriate access to the database, I would then do the following for existing users: modify the users to take away their DB_Owner access to the database and then add them to the MyRole.

For NEW users, I would do the following:

Add the new NT authenticated USer to the Server
EXEC sp_grantlogin 'Supreme\UserID'



Make the Database the default Database for this user:
sp_defaultdb 'Supreme\USerID', 'MyDatabase'



Add the user to the role:
sp_addrolemember 'MyRole', 'Supreme\userid'



Does that look like the logical sequence? did I miss anything?



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search