0

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.

Pieces
  • 145
  • 6

1 Answers1

1

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.

Richard
  • 5,309
  • 1
  • 22
  • 20