Powered by Blogger.

Saturday, February 15, 2014

Rename database in sql server 2008

In this post we will discuss how to rename an existing database in sql server 2008. Also you can check out my previous posts on:

- Implement delete functionality in Gridview in Asp.Net

- Bind dropdownlist from enum in Asp.Net

- Data access block of Microsoft enterprise library 6.0 using inline sql statement

To rename a database use the following sql query.

Modify Name = TestDBNew ;

Here TestDB is the old database name and TestDBNew is the new database name.

While executing this query if you are getting the below error:

"The database could not be exclusively locked to perform the operation", then check this solution.

Hope it will be helpful to you.