sp_send_dbmail

  • Hi, Im using a select in sp_send_dbmail to provide the body of my email but I am also getting the row count

    EXEC msdb..sp_send_dbmail

    @profile_name = 'DB Mail',

    @recipients = 'allen.davidson@europe.mccann.com',

    @subject = 'UPSINCC Reveived Checks',

    @query = 'SELECT CAST(Message AS CHAR(60)), COALESCE(CAST(Value AS VARCHAR(6)),'''') FROM UPSINCC..tblChecksInReportLine ORDER BY ID',

    @query_result_header = 0,

    @exclude_query_output = 1

    my email looks like this

    Received checks for file: 0903CALocalCheck.xls

    Records sent = 221, records received = 221, OK

    Changes to Contact_Name 2

    Changes to Contact_Salutation 0

    Changes to Contact_First_Name_3_Digit_FL 0

    Changes to Contact_First_Name_IL 0

    Changes to Contact_First_Name 1

    Changes to Contact_Middle_Name 0

    Changes to Contact_Last_Name 0

    Changes to Contact_Job_Title 0

    Changes to Contact_Business_Name 0

    Changes to Contact_Address_Street 0

    Changes to Contact_Address_Line_2 0

    Changes to Contact_Address_City 0

    Changes to Contact_Address_Postal_Code 0

    Changes to Contact_Address_State 0

    (16 rows affected)

    Any ideas on how can I get rid of the (16 rows affected) message?

    Thanks

    Allen

  • put, at the top of the proc:

    SET NOCOUNT ON

    and at the bottom

    SET NOCOUNT OFF

    Max

  • Doh!

    Thanks Max

  • That's funny, if only I was there! 😀

    Max

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply