Forum Topic

Thanks for your participation and contribution.


Back to SQL Server

Database Size Information

Post a reply
1942 views
i90runner1
i90runner1
Database Size Information
 
--Database Size Info 
;with fs
as
(
    select database_id, type, size * 8.0 / 1024 size
    from sys.master_files
)
select top 10
    name as DatabaseName,
    (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
where database_id > 4
order by DataFileSizeMB desc


1-1 of 1

Reply to this discussion

You cannot edit posts or make replies: You should be logged in before you can post.