Join Us!

Spaces are allowed; punctuation is not allowed except for periods, hyphens, and underscores.
A valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.

Login

Enter your Project Envision username.
Enter the password that accompanies your username.
Request new password

How To Rename Microsoft Sql Server Database

From time to time Sql Server DBA have to change the database name. There can be several reasons to do so, for example durring the restore you assigned temporary name to a database. Another reason is that project for which you developed that database was renamed. From time to time such requirement comes from Management, who developed new naming convention for database names and you are responsible for implementing it.

In Sql Server 2000 for renaming the database we can use sp_renamedb stored procedure, as illustrated in below example. The full syntax for sp_renamedb procedure is sp_renamedb @oldName, @newName

exec sp_renamedb 'mydb', 'mynewdb'
The database name 'mynewdb' has been set.

In Sql Server 2005 and newer, we still can use the sp_renamedb stored procedure but it is recommended to use ALTER DATABASE MODIFY NAME command, as ilustrated in below example. The full syntax for alter command is: ALTER DATABASE oldName MODIFY NAME = newName

ALTER DATABASE mydb MODIFY NAME = mynewdb
The database name 'mynewdb' has been set.