Skip to content

Instantly share code, notes, and snippets.

@cove9988
Created August 24, 2015 02:11
Show Gist options
  • Save cove9988/71bc7b04afae4b4599a1 to your computer and use it in GitHub Desktop.
Save cove9988/71bc7b04afae4b4599a1 to your computer and use it in GitHub Desktop.
get database file group & physical location
SELECT
fg.data_space_id, fg.name,
ObjectName = OBJECT_NAME(p.object_id), p.index_id
,df.name, df.physical_name, [Size] = df.size*8/1024
FROM sys.filegroups fg
LEFT JOIN sys.database_files df
ON fg.data_space_id = df.data_space_id
LEFT JOIN sys.partitions p
ON fg.data_space_id = p.partition_number
WHERE (p.object_id>4096 or p.object_id IS NULL)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment