Very simple script that list the total size of a database and its transaction log.
If you need for SQL 2000 click here
/* DESCRIPTION List space used on databases CONFIGURATION none Compatibility list: MSSQL2012 MSSQL2008 MSSQL2005 DOES NOT WORK MSSQL2000 */ SELECT SERVERPROPERTY('SERVERNAME') ServerName, SERVERPROPERTY('IsClustered') IsCluster, SERVERPROPERTY('ProductVersion') AS ProductVersion, case when RIGHT(SUBSTRING(@@VERSION, CHARINDEX('Windows NT', @@VERSION), 14), 3)= 6.3 then 'Windows 2012R2' when RIGHT(SUBSTRING(@@VERSION, CHARINDEX('Windows NT', @@VERSION), 14), 3)= 6.2 then 'Windows 2012' when RIGHT(SUBSTRING(@@VERSION, CHARINDEX('Windows NT', @@VERSION), 14), 3)= 6.1 then 'Windows 2008R2' when RIGHT(SUBSTRING(@@VERSION, CHARINDEX('Windows NT', @@VERSION), 14), 3)= 6.0 then 'Windows 2008' when RIGHT(SUBSTRING(@@VERSION, CHARINDEX('Windows NT', @@VERSION), 14), 3)= 5.2 then 'Windows 2003' when RIGHT(SUBSTRING(@@VERSION, CHARINDEX('Windows NT', @@VERSION), 14), 3)= 5.1 then 'Windows XP' when RIGHT(SUBSTRING(@@VERSION, CHARINDEX('Windows NT', @@VERSION), 14), 3)= 5.0 then 'Windows 2000' else RIGHT(SUBSTRING(@@VERSION, CHARINDEX('Windows NT', @@VERSION), 14), 3) end, DB_NAME(db.database_id) DatabaseName, (CAST(mfrows.RowSize AS FLOAT)*8)/1024 RowSizeMB, (CAST(mflog.LogSize AS FLOAT)*8)/1024 LogSizeMB FROM sys.databases db LEFT JOIN ( SELECT database_id, SUM(size) RowSize FROM sys.master_files WHERE type = 0 GROUP BY database_id, type ) mfrows ON mfrows.database_id = db.database_id LEFT JOIN ( SELECT database_id, SUM(size) LogSize FROM sys.master_files WHERE type = 1 GROUP BY database_id, type ) mflog ON mflog.database_id = db.database_id WHERE db.database_id > 4
/* DESCRIPTION List space used on databases CONFIGURATION none Compatibility list: MSSQL2000 */ SELECT SERVERPROPERTY('SERVERNAME') ServerName, SERVERPROPERTY('IsClustered') IsCluster, SERVERPROPERTY('ProductVersion') AS ProductVersion, case when RIGHT(SUBSTRING(@@VERSION, CHARINDEX('Windows NT', @@VERSION), 14), 3)= 6.3 then 'Windows 2012R2' when RIGHT(SUBSTRING(@@VERSION, CHARINDEX('Windows NT', @@VERSION), 14), 3)= 6.2 then 'Windows 2012' when RIGHT(SUBSTRING(@@VERSION, CHARINDEX('Windows NT', @@VERSION), 14), 3)= 6.1 then 'Windows 2008R2' when RIGHT(SUBSTRING(@@VERSION, CHARINDEX('Windows NT', @@VERSION), 14), 3)= 6.0 then 'Windows 2008' when RIGHT(SUBSTRING(@@VERSION, CHARINDEX('Windows NT', @@VERSION), 14), 3)= 5.2 then 'Windows 2003' when RIGHT(SUBSTRING(@@VERSION, CHARINDEX('Windows NT', @@VERSION), 14), 3)= 5.1 then 'Windows XP' when RIGHT(SUBSTRING(@@VERSION, CHARINDEX('Windows NT', @@VERSION), 14), 3)= 5.0 then 'Windows 2000' else RIGHT(SUBSTRING(@@VERSION, CHARINDEX('Windows NT', @@VERSION), 14), 3) end, DB_NAME(db.dbid) DatabaseName, (CAST(mfrows.RowSize AS FLOAT)*8)/1024 RowSizeMB, (CAST(mflog.LogSize AS FLOAT)*8)/1024 LogSizeMB FROM sysdatabases db LEFT JOIN ( SELECT dbid, SUM(size) RowSize FROM master..sysaltfiles WHERE groupID = 1 GROUP BY dbid, groupID ) mfrows ON mfrows.dbid = db.dbid LEFT JOIN ( SELECT dbid, SUM(size) LogSize FROM master..sysaltfiles WHERE groupID <> 1 GROUP BY dbid, groupID ) mflog ON mflog.dbid = db.dbid WHERE db.dbid > 4