Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
microsoft.public.sqlserver.programming
rename MDF and LDF files?
Test Test
3/15/2007 8:30:00 PM
Is there a command to rename MDF and LDF physical files of the db? The
task is rename:
1) db name (sp_renamedb proc)
2) logical file name (alter database and mofify file command)
3) MDF and LDF files (can it be done using T-SQL command?)
Thanks for your help.
*** Sent via Developersdex
http://www.develop...
***
1 Answer
Tibor Karaszi
3/15/2007 8:39:00 PM
0
1) Use ALTER DATABASE instead. sp_renamedb is old and deprecated method.
3)
For 2000: No.
For 2005, yes and no. ALTER DATABASE allow you to change the physical name in the system tables, but
it won't rename the physical file. For that you have to ALTER DATABASE to rename the physical file,
stop SQL Server, rename the file in the file system (and make no mistakes here) then start SQL
Server. IMO, detach and attach is easier.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/d...
http://sqlblog.com/blogs/tib...
"Test Test" <farooqhs_2000@yahoo.com> wrote in message news:e3skCD0ZHHA.1220@TK2MSFTNGP03.phx.gbl...
> Is there a command to rename MDF and LDF physical files of the db? The
> task is rename:
>
> 1) db name (sp_renamedb proc)
> 2) logical file name (alter database and mofify file command)
> 3) MDF and LDF files (can it be done using T-SQL command?)
>
> Thanks for your help.
>
>
> *** Sent via Developersdex
http://www.develop...
***
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
rename MDF and LDF files?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password