Skip to content

Instantly share code, notes, and snippets.

@jeremykdev
Created July 16, 2016 17:22
Show Gist options
  • Save jeremykdev/c0d5b154a10b5623707d9b123200aa1c to your computer and use it in GitHub Desktop.
Save jeremykdev/c0d5b154a10b5623707d9b123200aa1c to your computer and use it in GitHub Desktop.
Find Microsoft SQL Server files by size
USE master;
SELECT
DB.name AS DatabaseName
, F.type_desc AS FileType
, F.size AS [SizeIn8KbPages]
, F.physical_name AS [PysicalFileName]
FROM sys.databases AS DB
INNER JOIN sys.master_files AS F ON ( DB.database_id = F.database_id )
ORDER BY F.size DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment