Azure SQL Database Script for Size

Sometimes you may not want to flip over to the Azure portal to grab the database size, such as the used space below.


So here is a handy script to run under the context of the database of interest.

       SUM(CAST (FILEPROPERTY (name, 'SpaceUsed') AS BIGINT) * 8192.) / 1024 / 1024 / 1024  as [Database Size In GBs]
FROM sys.database_files
WHERE type_desc = 'ROWS';




1 thought on “Azure SQL Database Script for Size

  1. Pingback: Dew Drop – August 13, 2019 (#3009) | Morning Dew

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s