How to check Edition and Max Size of SQL Azure Database trough T-SQL query

Its very often requierd to check what's the edition (Web, Business) and maximum size (1GB, 5GB, 10GB, 20GB, 30GB, 40GB, 50GB) of a SQL Azure database.  There are two ways to do this.

1. Check the database properties in the Azure portal https://windows.azure.com/
2. Run a T-SQL query against your database

I find the latter approach quite handy. Here's the query:

SELECT DATABASEPROPERTYEX('Database_Name', 'EDITION')

SELECT DATABASEPROPERTYEX('Database_Name', 'MaxSizeInBytes')
OR
SELECT CONVERT(BIGINT,DATABASEPROPERTYEX ( 'Database_Name' , 'MAXSIZEINBYTES'))/1024/1024/1024 AS 'MAXSIZE IN GB'

Remember that it needs to be executed on the database you want to check, not on the master database. Then you might ask why the database_name is required? I don't know! :)

Here's the full list of properties supported in this function: http://msdn.microsoft.com/en-us/library/ee621786.aspx

2 comments:

Anonymous said...

Thankyou!

Unknown said...

• Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updatingAzure Online Training Hyderabad

Post a Comment

Please let me know if you find it useful!