Print database_size from sp_spaceused
Another way to accomplish this without the creating database objects is to use the below query taken from the sp_spaceused stored procedure itself:

declare @dbsize bigint
declare @logsize bigint

select @dbsize = sum(convert(bigint,case when status &amp; 64 = 0 then size else 0 end))
, @logsize = sum(convert(bigint,case when status &amp; 64 &lt;&gt; 0 then size else 0 end))
from dbo.sysfiles

select ltrim(str((convert (dec (15,2),@dbsize) + convert (dec (15,2),@logsize)) 
* 8192 / 1048576,15,2) + ' MB') as Database_Size