Created
June 29, 2016 21:16
-
-
Save digioz/ca93bb8298e983eb45645823874fd1d2 to your computer and use it in GitHub Desktop.
Get Size of All Databases on SQL Server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT d.name, | |
ROUND(SUM(mf.size) * 8 / 1024, 0) Size_MBs | |
FROM sys.master_files mf | |
INNER JOIN sys.databases d ON d.database_id = mf.database_id | |
WHERE d.database_id > 4 -- Skip system databases | |
GROUP BY d.name | |
ORDER BY d.name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment