Skip to content

Instantly share code, notes, and snippets.

@martin9700
Created January 4, 2015 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martin9700/0b875f21aed4c9b1f818 to your computer and use it in GitHub Desktop.
Save martin9700/0b875f21aed4c9b1f818 to your computer and use it in GitHub Desktop.
with fs
as
(
select database_id, type, size * 8.0 / 1024 size
from sys.master_files
)
select
name,
(select sum(size) from fs where type = 0 and fs.database_id = db.database_id) DataFileSizeMB,
(select sum(size) from fs where type = 1 and fs.database_id = db.database_id) LogFileSizeMB
from sys.databases db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment