Databases sizes in Bytes, MBs & GBs in SQL Server

Spread the love

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


Spread the love
Author: OTi
Meet OTi, the brains behind the popular tech blog "OurTechIdeas.com." OTi is an accomplished author, tech enthusiast, and an expert in SQL Server. With over a decade of experience in the tech industry, he has become a trusted voice in the world of database management. OTi's passion for technology began at a young age, and he has been tinkering with computers ever since. He graduated with a degree in Computer Science and has since worked for some of the biggest tech companies in the world. His experience has given him a deep understanding of how technology works and how it can be used to improve our lives.

Leave a Reply

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