Here is a quick tip on finding the location of a database files and on updating that location. This tip works on SQL Server 2000 and SQL Server 2005.
— Get the file location for the data (mdf), index (idx), and logs (ldf)
Use MYDBName
Select name, physical_name
From sys.database_files
— Set the file location for a particular mdf, idx, or ldf file
Use MYDBName
Alter Database MYDBName modify file
(name=MYDBName,filename=’E:\SqlData\MYDBName.mdf’)
This comes in handy if the file name has been changed, or if the folders containing the database are being changed.
Posted by