/*
得到當前服務器所有數據庫大小(MB)
*/
SELECT MIN(D.name) as DBName
,SUM(convert(real,A.size)*8/1024) as [size(MB)] --單位轉換,原來size單位為8K
from sys.sysaltfiles AS A
LEFT JOIN sys.sysdatabases AS D ON A.dbid=D.dbid
GROUP BY D.name
ORDER BY D.name
得到當前服務器所有數據庫大小(MB)
*/
SELECT MIN(D.name) as DBName
,SUM(convert(real,A.size)*8/1024) as [size(MB)] --單位轉換,原來size單位為8K
from sys.sysaltfiles AS A
LEFT JOIN sys.sysdatabases AS D ON A.dbid=D.dbid
GROUP BY D.name
ORDER BY D.name