Created
April 14, 2018 21:28
-
-
Save alexandrebl/5f20bdcd43db5172cec478b9b954ba71 to your computer and use it in GitHub Desktop.
Sql Server Get DataBase Size
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
| select | |
| a.FILEID, | |
| [FILE_SIZE_MB] = | |
| convert(decimal(12,2),round(a.size/128.000,2)), | |
| [SPACE_USED_MB] = | |
| convert(decimal(12,2),round(fileproperty(a.name,'SpaceUsed')/128.000,2)), | |
| [FREE_SPACE_MB] = | |
| convert(decimal(12,2),round((a.size-fileproperty(a.name,'SpaceUsed'))/128.000,2)) , | |
| NAME = left(a.NAME,15), | |
| FILENAME = left(a.FILENAME,30) | |
| from | |
| dbo.sysfiles a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment