MS SQL Server Concepts and Programming Question:

How to rename databases in MS SQL Server?

MS SQL Server Interview Question
MS SQL Server Interview Question

Answer:

If don't like the name of a database, you can change it by using the "ALTER DATABASE" statement with the following syntax:

ALTER DATABASE database_name
MODIFY NAME = new_database_name

The tutorial example below shows you how change the database name from "GlobalGuideLineDatabase" to "GlobalGuideLine":

ALTER DATABASE GlobalGuideLineDatabase
MODIFY NAME = GlobalGuideLine
GO
The database name 'GlobalGuideLine' has been set.



Previous QuestionNext Question
How to create database with physical files specified in MS SQL Server?Why I am getting this error when renaming a database in MS SQL Server?