?
Solved

Creating/capturing user/group scripts

Posted on 2005-05-02
4
Medium Priority
?
214 Views
Last Modified: 2010-03-19
I am rather new to SQL Server 2000 and I have always created my users using the enterprise manager.


How can I export the users and groups into a script so I can recreate them if I need to rebuild the databases with scripts only?

If I can't export the existing users/groups, at least show me the syntax for creating a group, a user and then how to attach the user to the group.

Thanks!
0
Comment
Question by:schworak
  • 2
  • 2
4 Comments
 
LVL 30

Accepted Solution

by:
nmcdermaid earned 1000 total points
ID: 13914343
Right click on your database

All Tasks/Generate SQL Script

On the options tab you will find various options for scripting users and logins

You can use this to script out your users.


The script it creates looks pretty complicated but it should give you the idea.
0
 
LVL 3

Author Comment

by:schworak
ID: 13917207
That was exactly what I needed!

I just selected the user / roll and loggin and object permissions boxes, generated the scripts and I was done.

I just wanted to make sure I didn't have to recreate the logins by hand if something ever went wrong. I have the database scripts but I created them by hand in the first place.

Thanks for helping me down the road to learning this DBA stuff.
0
 
LVL 30

Expert Comment

by:nmcdermaid
ID: 13922247
No worries.

I dont think the EM scripts have passwords in them (to be expected) so you might have to substitute them in if you ever need to run them
0
 
LVL 3

Author Comment

by:schworak
ID: 13922754
Yeah, no passwords. But I am using windows login validation so just getting the users built works great.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question