automatic email | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

automatic email

Hi all,
I need to use this code EXEC sp_spaceused.
I need to write a code that emails me the out put value from the above SP. I have SQL server 2005 so I can use sp_send_dbmail. but i could not incorporate it to send me a email
any help is appreciated
thanks
Configure db mail first before using sp-send_dbmail procedure… The following is an example from BOL, you can replace the query with your procedure…and schedule it run as a job as need.. EXEC msdb.dbo.sp-send_dbmail
@profile_name = ‘AdventureWorks Administrator’,
@recipients = ‘[email protected]‘,
@query = ‘SELECT COUNT(*) FROM AdventureWorks.Production.WorkOrder
WHERE DueDate > ”2004-04-30”
AND DATEDIFF(dd, ”2004-04-30”, DueDate) < 2′ ,
@subject = ‘Work Order Count’,
@attach_query_result_as_file = 1 ;
MohammedU.
Moderator
SQL-Server-Performance.com
]]>