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
 General SQL Server Forums
 New to SQL Server Programming
 Granting Access to DBs

Author  Topic 

Grifter
Constraint Violating Yak Guru

274 Posts

Posted - 2010-08-27 : 09:54:01
Hi all

When I add a user to our system I run a small script that adds them to the user table and then I go in to login properties, pick sql server authentication, put in passwordand then add the user to the first database by ticking the box next to DB.

Supposing I was wanting to add this user to 3 or 4 DBs in one go then what would I run in with my script to do this, as opposed to doing it manually? I was thinking it would be sp_grantdbaccess, although I would have to go into each DB sql query analyser and run this seperately wouldn't I?

Is there any way of adding a user to multiple databases, effectively like ticking the box next to the required DBs in the database access window in enterprise manager, in one go?

Thanks

G

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-08-27 : 11:11:53
tick the boxes for the dbs u want to grant access in the user mapping tab
Go to Top of Page
   

- Advertisement -