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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Renaming Logical file names

Author  Topic 

tribune
Posting Yak Master

105 Posts

Posted - 2005-03-15 : 17:21:14
I just used this script to rename my database, but the file names .mdf and .ldf are the old name

EXEC sp_dboption 'OldDbName', 'Single User', 'TRUE'
EXEC sp_renamedb 'OldDbName', 'NewDbName'
EXEC sp_dboption 'NewDbName', 'Single User', 'FALSE'

-------------

sp_renamedb doesn't rename the actual file names and logical file names

is there an easy way to do this? thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-03-15 : 17:25:26
You can use ALTER DATABASE MODIFY FILE to rename the logical file names. To rename the actual files, you can detach the database, rename the files, then attach it with the new names.

Tara
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-03-15 : 17:27:06
ALTER DATABASE MODIFY FILE NAME = logical_file_name, NEWNAME = new_logical_name
ALTER DATABASE MODIFY FILE NAME = logical_file_name, FILENAME = os_file_name

See ALTER DATABASE in BOL...
just trying to catch up... oh well...
rockmoose
Go to Top of Page
   

- Advertisement -