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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add login/user

Status
Not open for further replies.

Ajb2528

Technical User
Feb 22, 2002
270
GB
Hi All!

How can I programatically add a user (using SQL Server authorisation) to a database and inherit another users permissions to stored-procs/views etc?

Regards,

Alan
 
SP_AddLogin or SP_GrantLogin (For windows users to login) to add the login into the SQL server, then use the GRANT and DENY keywords to add object permissions to the user accounts. Also, use sp_grantdblogin to grant login permissions to a particular database.

You can't do inherited permissions in SQL Server the way you are saying. What you need to do is create a SQL account that is mapped to a Windows Users group of some sort. Grant the permissions to that mapped login, then add your user to the Windows group which will "inherit" the permissions. Although, a deny in another group which the user is a part of will kill that same specifically granted permission on the first group.

Look this up in Books Online. It will give you more details.



Catadmin - MCDBA, MCSA
Beware the error of pre-emptive poultry inventory!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top