How to check Database size using sql script

  By Junaid A   Posted on August-15-2022 

How to check Database size using sql script

 

Solution

 

SELECT      sys.databases.name,  
            CONVERT(VARCHAR,SUM(size)*8/1024)+' MB' AS [Total disk space]  
FROM        sys.databases   
JOIN        sys.master_files  
ON          sys.databases.database_id=sys.master_files.database_id  
GROUP BY    sys.databases.name  
ORDER BY    sys.databases.name 


SELECT
    name,
    size,
    size * 8/1024 'Size (MB)',
    max_size
FROM sys.master_files;

 

 

Caculate database size in ms sql server

Find db size in ms sql server

By  asifjans    15-Aug-2022 Views  139



Comments


Your Comments

You may also read following recent articles