Created
September 21, 2025 09:14
-
-
Save hishaamn/edacf2492f04dd699b701e10550582e5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| EXEC sp_MSforeachdb ' | |
| IF ''?'' LIKE ''%Xdb.Collection.Shard%'' | |
| BEGIN | |
| USE [?]; | |
| SELECT | |
| DB_NAME() AS DatabaseName, | |
| name AS FileName, | |
| type_desc AS FileType, | |
| size/128 AS CurrentSizeMB, | |
| size/128.0 - CAST(FILEPROPERTY(name, ''SpaceUsed'') AS INT)/128.0 AS FreeSpaceMB, | |
| growth/128 AS GrowthSizeMB, | |
| CASE is_percent_growth | |
| WHEN 1 THEN CAST(growth AS VARCHAR(10)) + ''%'' | |
| ELSE CAST(growth/128 AS VARCHAR(10)) + '' MB'' END AS GrowthSetting | |
| FROM sys.database_files; | |
| END | |
| '; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment