February 3, 2006 at 2:46 pm
Hi All,
I know that this question is like a "newbie" question, but please help me on this.
How can I rename/change the .mdf & .ldf file name after I attach(restore) the database.
for example, the file name is old.mdf and old.ldf, I attach it as database: new.
then, I want to change the filename to be new.mdf & new.ldf
Is there any sql querry to do this?
Thank you very much for your answers
Cheers,
Andy J
February 5, 2006 at 3:22 pm
Pretty simple
1) Detach the database
2) Rename the files.
3) Attach the database. You'll probably have to put the path & file name in the "attch" screen.
4) all done
February 6, 2006 at 9:52 pm
Hi Andrew,
If renaming the database is your only concern then, u can try this query,
sp_renamedb 'Olddbname','Newdbname'
Cheers,
Raghu Pyapili
February 7, 2006 at 7:45 am
That will just rename the database. If you need to rename the files making up the database you must do that when the database is offline whether through a detatch or restore.
February 10, 2006 at 9:11 am
It Works
Thanks for the advise, guys
Best Regards,
Andrew J.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy