>Take a look at xp_sendmail
>
>-Mike
-----------------------------------
Thanks Mike. I did. Here is what I came up with:
1. My usp returns a char string. Since RETURN returns an int only, I created an OUTPUT var.
2. My code to send email (scheduled job) now became:
DECLARE @lcSQL varchar(2000)
SET @lcSQL = 'DECLARE @lc nvarchar(4000)
EXEC mydb.dbo.usp_myproc @lcResultString = @lc OUTPUT
PRINT @lc'
EXEC master.dbo.xp_sendmail 'emailaddress', @query = @lcSQL
A bit convoluted. Is this the best way to do it? I was hoping to be able to pass the parameter DIRECTLY to xp_sendmail. And what if the result is longer than 4000 chars?
Thank you,
Aristotle