Skip to content

Instantly share code, notes, and snippets.

@dcouto
Created May 21, 2018 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcouto/bbd53641fcfe6f62f98318e7112f396b to your computer and use it in GitHub Desktop.
Save dcouto/bbd53641fcfe6f62f98318e7112f396b to your computer and use it in GitHub Desktop.
SELECT
D.name,
F.Name AS FileType,
F.physical_name AS PhysicalFile,
F.state_desc AS OnlineStatus,
CAST((F.size*8)/1024 AS int) AS [FileSize (MB)]
--CAST(F.size*8 AS VARCHAR(32)) as SizeInBytes
FROM
sys.master_files F
INNER JOIN sys.databases D ON D.database_id = F.database_id
ORDER BY
[FileSize (MB)] DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment