• It has nothing to do with the sendmail proc at all.

    You can't assign the result of an EXEC to a variable like that.

    One way would be to rewrite dbo.usp.AuditTrail_rpt to return the result set in an OUTPUT parameter, if it's plain text.

    If it's a table you might be better off to store the result set in a global temp table and use the @query parameter.

    As a side note: I strongly recommend to use sp_send_dbmail instead of xp_smtp_sendmail...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]