Backing Up and Restoring Logins
You can back up and restore logins using a script as described in the following procedures.
To back up a login using a script (SQL Server 2005 or SQL Server 2008)
- Start SQL Server Management Studio.
- Expand the Security folder, and then expand the list of Logins.
- Right-click the login you want to create a backup script for, and then select Script Login as.
- Click CREATE To, and then click one of New Query Editor Window, File, or Clipboard to select a destination for the script. Typically, the destination is a file with a .sql extension.
- Repeat this procedure from Step 3 for each login you want to script.
To restore a login from a script (SQL Server 2005 or SQL Server 2008)
- Start SQL Server Management Studio.
- Click File, click Open, and then click File.
- Locate and open the file containing the scripted login.
- Execute the script to create the login.