all groups > sql server new users > march 2005 >
You're in the

sql server new users

group:

How to change Database name in SQLServer?


Re: How to change Database name in SQLServer? Fredrik Wahlgren
3/23/2005 10:57:40 AM
sql server new users:
[quoted text, click to view]

You can use sp_renamedb

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

Arguments
[@dbname =] 'old_name'

Is the current name of the database. old_name is sysname, with no default.

[@newname =] 'new_name'

Is the new name of the database. new_name must follow the rules for
identifiers. new_name is sysname, with no default.

Return Code Values
0 (success) or a nonzero number (failure)

Permissions
Only members of the sysadmin and dbcreator fixed server roles can execute
sp_renamedb.

Examples
This example changes the name of the accounting database to financial.

EXEC sp_renamedb 'accounting', 'financial'

/D

How to change Database name in SQLServer? zlf
3/23/2005 4:38:01 PM
I want to change some Databases' name. But the only way I know is backup the
database, and change another name when recovering it. Is there any other way
that is easier than that below? thanks

zlf

AddThis Social Bookmark Button