| title | Rename a Database | Microsoft Docs | ||
|---|---|---|---|
| ms.custom | |||
| ms.date | 03/14/2017 | ||
| ms.prod | sql-server-2016 | ||
| ms.reviewer | |||
| ms.suite | |||
| ms.technology |
|
||
| ms.tgt_pltfrm | |||
| ms.topic | article | ||
| helpviewer_keywords |
|
||
| ms.assetid | 44c69d35-abcb-4da3-9370-5e0bc9a28496 | ||
| caps.latest.revision | 19 | ||
| author | BYHAM | ||
| ms.author | rickbyh | ||
| manager | jhubbard |
This topic describes how to rename a user-defined database in [!INCLUDEssCurrent] by using [!INCLUDEssManStudioFull] or [!INCLUDEtsql]. The name of the database can include any characters that follow the rules for identifiers.
In This Topic
-
Before you begin:
-
To rename a database, using:
-
Follow Up: After renaming a database
- System databases cannot be renamed.
Requires ALTER permission on the database.
-
In Object Explorer, connect to an instance of the [!INCLUDEssDEnoversion], and then expand that instance.
-
Make sure that no one is using the database, and then set the database to single-user mode.
-
Expand Databases, right-click the database to rename, and then click Rename.
-
Enter the new database name, and then click OK.
-
Connect to the [!INCLUDEssDE].
-
From the Standard bar, click New Query.
-
Copy and paste the following example into the query window and click Execute. This example changes the name of the
AdventureWorks2012database toNorthwind.
USE master;
GO
ALTER DATABASE AdventureWorks2012
Modify Name = Northwind ;
GO Back up the master database after you rename any database.