liversen
asked on
Get path and name of data file and log file for a given sql 2000 database
Hi
For doing a restore with move I need to be able to ask any given database what its datafile (Mdf) and its logfile (ldf) is.
So I need to query the server and get these two pieces of information.
How do I do that?
(SQL server 2000)
For doing a restore with move I need to be able to ask any given database what its datafile (Mdf) and its logfile (ldf) is.
So I need to query the server and get these two pieces of information.
How do I do that?
(SQL server 2000)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think
select * from sysdatabases where name = 'DBNAME'
is more appropriate.
select * from sysdatabases where name = 'DBNAME'
is more appropriate.
Actually its not. That query only shows the data file location...it doesn't include the log file.
ASKER
Just so that you know:
I have chosen to do this:
SELECT filename FROM MYDATABASE.dbo.sysfiles
and it does what I need. thanks again.
I have chosen to do this:
SELECT filename FROM MYDATABASE.dbo.sysfiles
and it does what I need. thanks again.
ASKER