Created
February 4, 2023 22:37
-
-
Save BobPusateri/40a843e79f153f9df387392becdf9d99 to your computer and use it in GitHub Desktop.
Gets info about all the files in a specific filegroup
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 | |
a.FILEID As FileID, | |
a.groupid AS FileGroupID, | |
a.[name] AS LogicalName, | |
a.[filename] AS FilePath, | |
ROUND(CAST(a.size AS FLOAT)/128,2) AS Reserved_MB, | |
ROUND(CAST(FILEPROPERTY(a.name,'SpaceUsed') AS FLOAT)/128,2) AS Used_MB, | |
ROUND(CAST(a.size AS FLOAT)/128 - CAST(FILEPROPERTY(a.name,'SpaceUsed') AS FLOAT)/128,2) AS Free_MB | |
FROM dbo.sysfiles a | |
WHERE a.groupID = 16 | |
ORDER BY Reserved_MB DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment