fredagen den 18:e september 2009

Rename Database

I had to rename a database in our testenvironment and the procedure to do it is like this:

Use the following T-SQL: command to make the database name change.
EXEC sp_renamedb 'oldName', 'newName'
This command works for both SQL Server 2000 and SQL Server 2005, but this feature will not be supported in future versions of SQL Server.

The new command that should be used for SQL Server 2005 and beyond is:
ALTER DATABASE oldName MODIFY NAME = newName

The full article can be read at http://www.mssqltips.com/tip.asp?tip=1122

Stefan

0 kommentarer: