Monday, March 10, 2008

How To Rename The Database In SQL Server

sp_renamedb
Changes the name of a database.

Syntax
sp_renamedb [ @dbname = ] 'old_name' , [ @newname = ] 'new_name'


[@dbname =] 'old_name'
              The current name of the database. old_name is sysname

[@newname =] 'new_name'
             The new name of the database. new_name must follow the rules for identifiers


Example:

CREATE DATABASE xample

sp_renamedb
'xample','Example'

No comments: