RENAMING YOUR DATABASE IN SQL SERVER 2005

Use of sp_renamedb

It changes the name of a database.
Synatx is : sp_renamedb ‘old_name’,’new_name’

exec sp_renamedb ‘Testing’, ‘NewTesting’

OUTPUT
________

The database name ‘NewTesting’ has been set.

You can check the same in sys.databases.

SELECT name , create_date , collation_name FROM SYS.DATABASES where name = ‘NewTesting’

name create_date collation_name
———————————————————————-
NewTesting 2010-08-13 19:07:50.080 SQL_Latin1_General_CP1_CI_AS

(1 row(s) affected)

Pawan Kumar
Pawankkmr@hotmail.com