Skip to content

Instantly share code, notes, and snippets.

@justingarrick
Last active October 4, 2015 05:48
Show Gist options
  • Save justingarrick/2588809 to your computer and use it in GitHub Desktop.
Save justingarrick/2588809 to your computer and use it in GitHub Desktop.
Find Data Directory of Remote SQL Server Instance
SELECT SUBSTRING(physical_name, 1, CHARINDEX(N'master.mdf', LOWER(physical_name)) - 1)
FROM master.sys.master_files
WHERE database_id = 1 AND file_id = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment