May 8, 2007 at 9:18 am
I'm able to send out the results of a query utilizing sp_send_dbmail.
I would like to cancel the email without generating an error message if the rowcount = 0.
I've been experimenting with the variable @append_query_error = 1.
It only cancels the email if I use the raiserror function with a severity level higher than 10.
Anything 10 or below (informational message), is viewed as a success and the message still goes.
I've tried using a return value of -101 within my sp and that doesn't work either.
Any suggestions besides trying to figure out how to do the same thing with SSIS?
Thanks,
James
May 8, 2007 at 11:11 am
We haven't setup Database Mail (yet) but I had a similiar requirement using SQL Mail on two SQL Server 2000 systems. I populated a temporary table with the information from a user developed stored procedure. Next, using a if statement, I checked for valid data in the table using the same query I had setup to run in the xp_sendmail command. If the query returned any values (used if exists(select ..) the xp_sendmail command is executed, else it is skipped.
You should be able to do something similiar using Database Mail.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply