-
Script Roles User Belongs to in SQL 2005
I cannot figure out how to script the roles that users belong to in SQL 2005 Management Studio. I can get it to script the users and I can get it to script the Roles in the database. But I cannot get it to script the users as members of the roles that they belong to in SQL 2005.
In SQL 2000 Enterprise Manager, you could right click on a database and go to All Tasks>Generate SQL Script and go to the Options tab and select 'Script database users and database roles' and it would give you the sp_grantdbaccess and sp_addrolemember statements to recreate the users correctly.
Let me know if you have figured out how to do the same thing in 2005 yet.
Thanks,
Anthony
Last edited by avalenti; 08-21-2006 at 12:52 PM.
-
-
Well that's fine if I just want to see what role each user belongs to and type them in manually. But I want to script the users out of each database so that I can add the users back after a restore with the same roles as before. Usually the restore is for a test environment and the users become orphaned. There are many databases and doing all of it manually doesn't seem like a good option. Why wouldn't MS include at least the same scripting functionality as we had before with Enterprise Manager?
Last edited by avalenti; 08-28-2006 at 07:51 AM.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|