How to Rename Database in sqlserver

you can rename a database in SQL Server 2005,2008 and 2012 by using SQL Server Management Studio or Transact-SQL.

Here i am describe all the ways to rename a Database .

Rename Database using Transact-SQL.:


1-sp_renameDB 'oldDB','newDB'


2-ALTER DATABASE Test MODIFY NAME = NewTest

Using SQL Server Management Studio To rename a Database:

1-In Object Explorer, right-click the database you want to rename and choose Design from the shortcut menu.
2-From the View menu, choose Properties.
3-In the field for the Name value in the Properties window, type a new name for the database.
4-To cancel this action, press the ESC key before leaving this field.
5-From the File menu choose Save name.
Tags: ,

Join Us!