Last active
November 16, 2023 15:41
-
-
Save craigtp/3237124 to your computer and use it in GitHub Desktop.
List the largest databases on a SQL Server instance
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 DB_NAME(database_id) AS DatabaseName, | |
Name AS Logical_Name, | |
Physical_Name, (size*8)/1024 SizeMB | |
FROM sys.master_files | |
ORDER BY SizeMB DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Completing the table name with database name "master" in the FROM clause avoids this
This code runs independently of the selected database