Can I use a query in MSSQL to get the .mdf and .ldf filename/location for a specific database?
views:
755answers:
3
+2
A:
SELECT * FROM sys.database_files (SQL 2005+)
SELECT * FROM dbo.sysfiles (SQL 2000)
gbn
2008-12-09 18:51:40
A:
SELECT * FROM sys.master_files
...will give you a basic view of where your database lives. It might not cope too well with filegroups, etc.
Roger Lipscombe
2008-12-09 18:52:18
+1
A:
You can use:
exec sp_helpfile
Will return a query containing information about the files of the current database.
This will work on any SQL server version.
GvS
2009-03-26 09:32:43