declare @totalsize float,
@bytes float,
@kb float,
@mb float,
@gb float,
@tb float

CREATE TABLE #temp
(
size int
)

insert into #temp (size) EXECUTE sp_msforeachdb 'SELECT size FROM [?].sys.database_files'

select @totalsize = SUM(size) from #temp
set @bytes = (@totalsize * 8192)
set @kb = (@bytes / 1024)
set @mb = (@kb / 1024)
set @gb = (@mb / 1024)
set @tb = (@gb / 1024)

drop table #temp

--print @totalsize
--print @kb
--print @mb
print @gb
print @tb
