Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Send email with value returned from StoredProc
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
00479640
Message ID:
00480010
Vues:
20
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform