Tuesday, 30 June 2015

How to list all database files in SQL Server ?

SELECT name, physical_name AS current_file_location,*
FROM master.sys.master_files
                       (OR)
SELECT DB_NAME([dbid])AS [Database Name], fileid, [filename]
FROM sys.sysaltfiles
WHERE [dbid] > 0 AND [dbid] <> 32767
OR [dbid] = 2;

No comments:

Post a Comment