Rename Database Using T-SQL in SQL Server 2008

In this article I describe how to change database name using SQL query.
  • 2339


In this article I describe how to rename database using T-SQL statement. There are various approaches to change SQL Server database name. Sometimes condition arises when you need to rename your database like refreshing the development server with current data or while restoring database and at that time you just give a temporary name but after that you need to rename it on your system.


ALTER DATABASE 'Old_Database_Name' MODIFY NAME= 'New_Database_Name'

Change database name using T-SQL statement

Step 1

Open SQL Server Management Studio and connect to database engine.

Step 2

Open New Query window.

Step 3

Type following code and execute it.

/* create databse */

create database EmployeeDetails


/* change database name*/

alter database EmployeeDetails

modify name= EmployeePersonalDetails


rename database.jpg


More Articles

© 2020 DotNetHeaven. All rights reserved.