MS SQL Server Concepts and Programming Question:
Download Questions PDF

How to rename databases in MS SQL Server?

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.


Download MS SQL Server Interview Questions And Answers PDF

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?