Home > Archive > MS SQL Server > February 2006 > Rename MDF file









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Rename MDF file
George Schneider

2006-02-05, 3:23 am

Is there a way to rename the mdf and ldf files associated with a databse.
Also can I rename the fil nemae that is created for these when the databse
gets created.
Jéjé

2006-02-05, 3:23 am

you can detach the database
rename the files
attach the database by specifying the new file names

"George Schneider" < georgedschneider@new
s.postalias> wrote in message
news:25A21625-0C18-465F-ADCF- D0AB6B66F002@microso
ft.com...
> Is there a way to rename the mdf and ldf files associated with a databse.
> Also can I rename the fil nemae that is created for these when the databse
> gets created.



Dan Guzman

2006-02-05, 9:23 am

To add to Jéjé's response, you can rename logical file names with ALTER
DATABASE. For example:

ALTER DATABASE MyDatabase
MODIFY FILE(
NAME='MyOldLogicalNa
me',
NEWNAME='MyNewLogica
lName')

See the Books online for more information.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"George Schneider" < georgedschneider@new
s.postalias> wrote in message
news:25A21625-0C18-465F-ADCF- D0AB6B66F002@microso
ft.com...
> Is there a way to rename the mdf and ldf files associated with a databse.
> Also can I rename the fil nemae that is created for these when the databse
> gets created.



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com