-->

Find the Size of Database

Post a Comment

I encountered the situation recently where I needed to find the size of the database.

--size of database 
SELECT DB_NAME(database_id) AS DatabaseName,SUM((size*8)/1024) SizeInMB
FROM sys.master_files
GROUP BY DB_NAME(database_id) 
-- size of individual db files
SELECT DB_NAME(database_id) AS DatabaseName,
Name AS Logical_Name,
Physical_Name, (size*8)/1024 SizeInMB
FROM sys.master_files

Related Posts

There is no other posts in this category.

Post a Comment

Subscribe Our Newsletter