Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 database rename

Author  Topic 

sunsanvin
Master Smack Fu Yak Hacker

1274 Posts

Posted - 2007-06-08 : 05:08:53
Dear experts,
is it possible to rename a database?

I've tried with harsh suggesion from previous posts....


--alter database Script modify name= script_test
Use Master
GO

Alter database Script
Set Single_User
GO


THANK YOU VERY MUCH

Vinod
Even you learn 1%, Learn it with 100% confidence.

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-06-08 : 05:13:49
You can use sp_renamedb if you are doing this in SQL 2000.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-06-08 : 06:53:57
Note that this will not change the physical names of the LDF/MDF files, nor the logical [internal] names, so you may also want to change those to keep them in step.

Kristen
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-08 : 09:39:04
Also make sure that renaming the database doesnt affect any application which connects to that db

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

NeilG
Aged Yak Warrior

530 Posts

Posted - 2007-06-08 : 12:51:42
you can use the sp_renamedb in 2005 also
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-06-08 : 14:34:25
"you can use the sp_renamedb in 2005 also"
Even though it is supported in SQL 2005 for backward compatibility, it is not a preferred method. In SQL 2005, one should make use of ALTER DATABASE statement for this.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -