Sunday, October 5, 2014

Database size information - SQL Server

USE master
 
GO 
             
 
SELECT db.[name]                           AS 'DBName', 
       
                Sum(( Cast(( ( ( Cast(af.[size] AS NUMERIC(18, 4)) * 8192 ) / 1024 ) /  1024 ) AS                   
                      
                                NUMERIC(18, 2)) )) AS 'FileSize_MB'
FROM   sys.sysdatabases db 
      
                INNER JOIN sys.sysaltfiles af 
              
                                ON db.dbid = af.dbid 
GROUP  BY db.[name]
 

No comments:

Post a Comment