Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

not sure on how to pass custom error messages from ssis to sql agent job

$
0
0

I want to know how can I force my ssis package to fail based on some condition and when the job runs from sql agent I want to see the custom error message in sql agent result. Here is a brief scenario.

I want to know if a particular table was updated nightly, So I wrote a package and here is the code or brief explanation for that, in my excute sql task

select count(*) as Count
from dbo.orders
where RunDate>= '2013-01-04'

I assign the output of the above query in a vairable and then check the condition @[User::Count]<=0 t if is 0 then I know that table did not update and I can run the following code in execute sql task

exec msdb..sp_send_dbmail
@profile_name = 'Default_SMTP',
@recipients = 'Reporting@lulu.com',
@subject = Orders Table Status',
@body = 'Hello, Orders Table did not update.'

So I have this package which sends me an email every time when the Orders table is not updated and I am running this package as job from sql agent. When I look at the history of the job it shows sucessfully completed every time.

In sql agent I want to show as job status equal failed and give a descriptive error message when the email is sent out and completed when email is not sent out.

I know I can do catch some events in the event handler tab but not sure if it will show the message in the sql agent messages.

Thank you.


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>