Manipulating Databases

Other core administration tasks include renaming, dropping, deleting, detaching, and attaching databases. These tasks are examined in this section.

Renaming a Database

Although you cannot rename system databases, you can rename user databases using either SQL Server Management Studio or the ALTER DATABASE MODIFY NAME statement. With the database in single-user or offline mode, right-click the database name in SQL Server Management Studio and select Rename from the shortcut menu. Then type the database name and press Tab.

To use T-SQL to put the database in single-user mode and change the name, complete the following steps:

  1. Ask all users to disconnect from the database. Make sure that all SQL Server Management Studio connections ...

Get Microsoft® SQL Server® 2008 Administrator's Pocket Consultant now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.