May 19, 2010 at 8:59 am
Heelo,
I need to count the number of times 'Insert', 'Update' and 'Delete' appears in a field within my dataset and assign each count to a different variable.
I cannot use the conditional split to populate row counts or the multicast component as there are some limitations to the way a 3rd party component uses the data which would take too long to go into here.
But the long and short of it is, how would I do this within a script component?
Thanks in advance
May 19, 2010 at 1:51 pm
I think the long and short is HOW do you know which action is being taken?
CEWII
May 20, 2010 at 5:28 am
The following set-up should work:
in your script task, create 3 variables that will hold the counters.
Create a nested if then else statement in the Input0_ProcessInputRow method, which checks the value of your field. Update the counter accordingly. Something in the style of:
If Row.myfield.toString = "INSERT"
then insert_Counter += 1 else if Row.myfield.toString = "UPDATE" then
et cetera
Make sure you already created the necessary variables in your SSIS package and use them as ReadWriteVariables.
In the PostExecute, assign the values of your counters to the variables.
For example:
Me.Variables.Insert_Count = insert_Counter
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply