Monday, February 20, 2012

Problem with package creation

Hello,

I am creating a package and I have a problem with it. I want to execute a sql task that checks if there are some records with some specifications available in my table. That's very easy to do. After this step I want to send a mail message to the user, but only if there are some records available. If there aren't, it may not send a mail.
The result of the SQL task is always successfull (if there are some records or not), so I can't use the 'On Success'-workflow for it. Can you tell me how to do it, or is there another alternative for doing it?
Thx for helping me out.

TomHave the sql task execute a stored procedure that handles the logic to email or not to email (using xp_sendmail) -- that is the question :-)|||Use RASIERROR within your SQL Task

IF NOT EXISTS (SELECT * FROM myTable)
RAISERROR('',16,1)


If there are no records a RAISERROR will be done and therefore the "On Failure" will be performed.|||Thx for the solution achorozy!

No comments:

Post a Comment