Tuesday, November 25, 2008

How to rename a SQL Database

You can not rename a SQL Server database from Enterprise Manager, but you can with the sp_renamedb stored procedure. You must first set the database to singe user.

1. Set the database to Single User by right clicking the database in Enterprise Manager, select Properties, select the Options Tab, check the Restrict Access checkbox, and select Read-Only, then click OK.
2. Close Enterprise Manager (since we can only have 1 user accessing it at a time now).
3. Open Query Analyser.
4. Type: sp_renamedb ,
5. Don't forget to reset the Restrict Access settings on the database that you changed in step 2.

No comments:

Subscribe free via email

Enter your email address:

Delivered by FeedBurner

...