[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 84
  • Last Modified:

How to use scripting component as transformation in SSIS

Hi Guys,
I want to perform some operations for each record from the source and then do some operations in scripting component. I also want to catch the error and save the error in a log table and if no error then insert record in destination table.

Is there any tutorial on this?  I need a starting point though, I assume there would be some sort of variables i would need to use?

regards
0
shah36
Asked:
shah36
1 Solution
 
Megan BrooksSQL Server ConsultantCommented:
It sounds like you want to use implement a transformation where the data is processed row by row but which can, in effect, provide an error output if internal processing fails.

You can implement more than one output on the transformation, and send "good" rows to one output and "bad" rows to the other. This assumes that your code can trap any execution errors internally, which should be straightforward to do using ordinary error handling.

It has been a few years since I have written one of these but I believe you can use a synchronous transformation with multiple outputs and exclusion groups to do what you want to do.

The DirectToRow method, called within your script, lets you select the output to use for each input row, and you would use it to send to one output on success and another on failure. The two types of insert can then be performed in downstream components, one on each output. Exclusion groups are the key to, in effect, "branching" within the data flow following execution of the script component.

Have a look at the above link (select the version of SSIS that you are using) and see if that is what you are looking for, given the approach that I suggested above.
0
 
shah36Author Commented:
Thank you so much for your help. Yes that's what i needed.

Regards,

Ali
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now