Databases sizes in Bytes, MBs & GBs in SQL Server

Introduction

Get all SQL Server databases sizes in Bytes, MBs & GBs. Here in script f.size is the number of 8K pages in the database,  so there are f.size * 8 * 1024 bytes in the database & the rest is pure conversion to mega/giga/ etc..
There are 1048576 bytes in a megabyte, 1073741824 bytes in a gigabyte.

Script

Simply copy the below script & run it in SSMS

Result

Here is the output

Facebook Comments Box
Please like or share this post if you found it helpful, thank you.
Share on Facebook
Facebook
0Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin
Email this to someone
email
Print this page
Print

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *