Wednesday, March 7, 2012

logical filename

Is there a way to change the logival filename of a database? I did a restore
of one database to another and the logical name is the same in the new
database. Thanks.
There are no straight forward way to do this. You can edit the sysfiles1
system table and change the logical name of database.
Refer system tables, direct updates
Note: Modifying system tables may corrupt the database.
Thanks
Ravi
"Tom Reis" wrote:

> Is there a way to change the logival filename of a database? I did a restore
> of one database to another and the logical name is the same in the new
> database. Thanks.
>
>
|||Ravi,
We can do the rename using ALTER DATABASE command from SQL 2000 onwards.
Tom,
For changing the Logical file name see the below command:-
ALTER DATABASE <DBNAME> modify file (NAME = 'old_MDF_NAME', NEWNAME =
'NEW_MDF_NAME')
do the same for LDF file as well.
Note:
We can not change the logical file name in SQL 7. The command will only work
in SQL 2000.
Thanks
Hari
SQL Server MVP
"Tom Reis" <reistom@.cdnet.cod.edu> wrote in message
news:u7M9AhbfFHA.2484@.TK2MSFTNGP15.phx.gbl...
> Is there a way to change the logival filename of a database? I did a
> restore
> of one database to another and the logical name is the same in the new
> database. Thanks.
>
|||Hi Tom
Please always state what version of the product you are using.
In SQL Server 2000, you can use ALTER DATABASE to change the logical
filename.
You could not do it in SQL Server 7.
Earlier than that, there was no concept of logical files for a database.
HTH
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"Tom Reis" <reistom@.cdnet.cod.edu> wrote in message
news:u7M9AhbfFHA.2484@.TK2MSFTNGP15.phx.gbl...
> Is there a way to change the logival filename of a database? I did a
> restore
> of one database to another and the logical name is the same in the new
> database. Thanks.
>

No comments:

Post a Comment