How to Rename a Database in SQL Server: A Detailed Guide

Rumman Ansari   Software Engineer   2024-07-19 03:31:19   6350  Share
Subject Syllabus DetailsSubject Details
☰ TContent
☰Fullscreen

Table of Content:

To alter a database, once it's created

Code: SQL Server


Alter database DatabaseName Modify Name = NewDatabaseName

Alternatively, you can also use system stored procedure

Code: SQL Server


   Execute sp_renameDB 'OldDatabaseName','NewDatabaseName'

Graphically using SQL Server Management Studio (SSMS)

Step 1: Right click on the database name, then press rename.

Step 2: Write New Database Name and Press Enter



Stay Ahead of the Curve! Check out these trending topics and sharpen your skills.