Home

Renaming a Database

 

Description

To change the name of a database, Transact-SQL provides sp_renamedb. The formula used would be:

EXEC sp_renamedb 'ExistingName', 'NewName'

The EXEC sp_renamedb expression is required.

The ExistingName factor is the name of the database that you want to rename.

The NewName factor is the name you want the database to have after renaming it.

Here is an example of renaming a database:

EXEC sp_renamedb 'RentalCars', 'BethesdaCarRental
GO
 
 
   
 

Home Copyright © 2009-2016, FunctionX, Inc.