SQL query to display database sizes

You can ran this SQL query against the Ops DB and the Ops DW to display database size information…….

select
‘server’ = @@servername
, ‘total size in megabytes’= convert(decimal(10,2),(sum(size * 8.00) / 1024.00 ))
, ‘total size in gigabytes’ = convert(decimal(10,2),(sum(size * 8.00) / 1024.00 / 1024.00))
, ‘total size in terabytes’ = convert(decimal(10,2),(sum(size * 8.00) / 1024.00 / 1024.00 / 1024.00)) from
sys.master_files

 

Advertisements
This entry was posted in SQL Queries and tagged , , , , , , , , , . Bookmark the permalink.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s