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.
| Author |
Topic |
|
nic
Posting Yak Master
209 Posts |
Posted - 2004-05-18 : 19:51:02
|
| Hi,Is there anyway you can change the filename of the data and log files after you have created a database? I want to create a copy of a pre-existing database. In the past I have copied databases by making a backup, going to the new server, creating a database and restoring the backup into the new database (force the restore). This works well (especially if you need to burn the backup on CD or something). The only problem is the fileName of the datafiles remain the same in the new db. For example:original database name: origDBfileName: origDB_Datalocation: \networkPath\origDB_Data.mdfnew database name: newDBfileName: origDB_Datalocation: \networkPath\newDB_Data.mdfIt would be nice if you could rename the fileNames. (This isn't an issue if you keep the database name, but sometimes we will have a production db, and test db. Changing the names would be nice)Nic |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2004-05-18 : 20:13:42
|
| I think this is the command:ALTER DATABASE newDBMODIFY FILE (NAME = origDB_Data, NEWNAME = newDB_Data)If not, take a look at ALTER DATABASE MODIFY FILE in SQL Server Books Online.Tara |
 |
|
|
|
|
|