Skip to content

Instantly share code, notes, and snippets.

@RobbiNespu
Created July 9, 2024 01:10
Show Gist options
  • Save RobbiNespu/cc88831a07a23f272610437813fb2f2d to your computer and use it in GitHub Desktop.
Save RobbiNespu/cc88831a07a23f272610437813fb2f2d to your computer and use it in GitHub Desktop.
MSQL : Find location of DATA and LOG
SELECT
d.name AS DatabaseName,
mf.type_desc AS FileType,
mf.physical_name AS FilePath
FROM
sys.master_files mf
JOIN
sys.databases d ON mf.database_id = d.database_id
WHERE
d.name NOT IN ('master', 'model', 'msdb', 'tempdb') -- Exclude internal databases
ORDER BY
DatabaseName, FileType;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment