June 26, 2008 at 8:40 am
I am storing the record counts of both source table and destination table in a table within sql server which I import using SSIS data flow task. Sometimes due bad data some data in the source the erroneous rows are routed to a bad file.
However whenever that happens the source table and destination recordcount doesnt match. In such a situation I would like to fail the package. Whats the best way to accomplish this... thanks
June 26, 2008 at 8:47 am
I would use a script task to compare the 2 vars after I do the counts. Then, if they don't match, you can fail that step by just putting the failure code inside your IF statement. The failure code is at the bottom of every script task anyway, so just paste it where you need it.
Then set that script's properties to fail the package on failure and you should be all good.
And if you don't know how to work with variables in script tasks, watch my video on the topic:
http://midnightdba.itbookworm.com/SSISVarsInScript/SSISVarsInScript.html
Watch my free SQL Server Tutorials at:
http://MidnightDBA.com
Blog Author of:
DBA Rant – http://www.MidnightDBA.com/DBARant
June 26, 2008 at 11:55 am
would it possible that you expand on your reply.. thanks
June 27, 2008 at 9:27 am
You asked me to elaborate so I made you another video. Hope this helps.
http://midnightdba.itbookworm.com/ssisforcepackagefailure/ssisforcepackagefailure.html
Watch my free SQL Server Tutorials at:
http://MidnightDBA.com
Blog Author of:
DBA Rant – http://www.MidnightDBA.com/DBARant
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply