Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

granting user access to db AND permission in role 1

Status
Not open for further replies.

mpastore

Programmer
Mar 12, 2003
568
US
Hi,

I am using sp_grantdbaccess to grant a user access to a database. However, I also need to permit the user in a role, just like it is done in SQL log-in properties dialogue bix, except I need to do this all in t-sql.

Thanks Mike

Mike Pastore

Hats off to (Roy) Harper
 
oops, got ahead of myself there

USE db
GO
EXEC sp_grantdbaccess 'domainLogonName', 'dbLogonName-can be null if same as domain'
GO
EXEC sp_addrolemember 'roleName', 'dbLogonName'
 
Actually it was sp_addrolemember, but you got me 1/2 way there, star for you!

Mike Pastore

Hats off to (Roy) Harper
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top