Skip to content

Latest commit

 

History

History
85 lines (56 loc) · 2.77 KB

File metadata and controls

85 lines (56 loc) · 2.77 KB
title Rename a Database | Microsoft Docs
ms.custom
ms.date 06/13/2017
ms.prod sql-server-2014
ms.reviewer
ms.technology
ms.topic conceptual
helpviewer_keywords
databases [SQL Server], renaming
renaming databases
ms.assetid 44c69d35-abcb-4da3-9370-5e0bc9a28496
author stevestein
ms.author sstein
manager craigg

Rename a Database

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

Limitations and Restrictions

  • System databases cannot be renamed.

Security

Permissions

Requires ALTER permission on the database.

Using SQL Server Management Studio

To rename a database

  1. In Object Explorer, connect to an instance of the [!INCLUDEssDEnoversion], and then expand that instance.

  2. Make sure that no one is using the database, and then set the database to single-user mode.

  3. Expand Databases, right-click the database to rename, and then click Rename.

  4. Enter the new database name, and then click OK.

Using Transact-SQL

To rename a database

  1. Connect to the [!INCLUDEssDE].

  2. From the Standard bar, click New Query.

  3. Copy and paste the following example into the query window and click Execute. This example changes the name of the AdventureWorks2012 database to Northwind.

USE master;  
GO  
ALTER DATABASE AdventureWorks2012  
Modify Name = Northwind ;  
GO  

Follow Up: After renaming a database

Back up the master database after you rename any database.

See Also

ALTER DATABASE (Transact-SQL)
Database Identifiers