to get sizes of databases emailed to self

use msdb
exec sp_send_dbmail
@profile_name = ‘ss job notifications’,
@recipients = ‘put email address here’,
@subject = ‘live database sizes’,
@query = ‘use databasename select db_name(dbid),str(convert(dec(15),sum(size))* 8192/ 1048576,10,2)+ N” MB” as Size from sys.sysaltfiles
group by dbid order by 2 desc’,
@attach_query_result_as_file = 1;

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.