Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am attempting to setup a MS 2008 sql server that would allow many users access to there own private databases. I would like the adventure works databases installed on all of these as well. My question is there an easy way to script this task of setting up multiple databases for multiple users, and only allowing said user access to his/her own databases.

Note: The main problem is that the adventure works DB's would all have the same names. I was thinking of getting around this by adding different schema's.

share|improve this question
add comment

1 Answer

To create each database start by backing up adventureworks, then create each database and restore the adventureworks into that database.

To create all the user's you're going to need to CREATE LOGIN for each of them (creates the server level entity)1.

Then against their database CREATE USER and assign roles.


1 If there's more that a dozen or so this will get hard to manage with the GUI: this is a consequence of needing to assign different permissions to each login. If they were all being assigned the same roles in the same database you would create a Windows group (local or AD) and add that to SQL Server.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.