Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SSIS Generate an error in a data flow

Status
Not open for further replies.

joe69008

Programmer
Jun 29, 2005
42
0
0
FR
I have a dataflow that read a table.(row : "id_agency","id_society","name_society","name_agency", "turnover") There is a conditional split where if i have a "id_agency" or "id_society" at blank , i load this wrong data (and so all the line data) in a table called Refusal.
But after load all this "wrong line", i want to generate a raise error and so stop the ETL flow but i don't know how i could manage that. In the control data we can use a sql task et write a script with raise error but how i can manage to do that in a data flow and after have loaded a table ( refusal table).

Thanks in advance for any help and excuse me for my english mistake.

regardless,
 
Use a split conditional. Set a variable (a bit flag or whatever type you want) in your package. Then, at the step right before the Refusal table, use a script task to check for NULLS.

If you have NULLS, the conditional Success & Variable leads to the loading of the Refusal table which is your last step along that path. If you don't have NULLS, have the conditional Success & Variable lead down the other path which goes and does all your processing.



Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"
 
Thanks for your help.

When you said "If you have NULLS, the conditional Success & Variable leads to the loading of the Refusal table which is your last step along that path" it will be the last step of my data flow but the others data flow in the control flow will goes on. No?
 
No, not if you do it correctly.

You need to add 2 precendence constraints from your "Check for NULLS" task. Once you do, right click the precendence constraint and go to Edit. This is where you tell it "Not only does the above step have to succeed, but this variable must be this value to continue". Choose Expression And Constraint under the Evaluation box. Under Expression, enter the value of the variable.

SSIS will then only follow the dataflow path where the previous step succeeded and the variable value is directing it. The rest of the package, along the other data path, will not run at all.



Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"
 
It's OK , thanks a lot for your help.
A last question please, when the process don't run anymore, can we manage to show a message box for example or put the data flow in question in red , to show tu the user that the process stopped, because now when he stopped, there are no way to see if the process stopped or if the process run and "think"

thanks
 
That process visibility is only used in Debug mode in BIDS. When you're running the SSIS package properly, you don't see it at all (and shouldn't).

I'd recommend setting up DBMail and adding an email task after that "last task" to send out when the Refusal table is filled. If you want to populate the SendTo, create a variable that populates with the email address of the user who is running the package, then use that variable in the SendMail task. Or, if it's always going to be the same group of people using the package, just pre-populate the SendTo with all their addresses.



Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"
 
You're welcome.



Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"
 
hi again!!!

A last question please, can we generate a raiserror in a component script task or can we use the function exeption.

a thing like that :

"Public Class ScriptMain
Inherits UserComponent

Public Overrides Sub Entrée0_ProcessInputRow(ByVal Row As Entrée0Buffer)
'
' Add your code here

raiserror(errorcode,16,1)

End Sub

End Class""

thanks
 
Public Overrides Sub Entrée0_ProcessInputRow(ByVal Row As Entrée0Buffer)
'
Me.ComponentMetaData.FireError(-1, "error", "error null", "", 1, True)

'
End Sub

End Class

thanks
 
I've never tried to raise an error from the middle of an SSIS package, but you can play with it.

The main problem I see with this (and you'd have to test it to be sure) is that since SSIS packages are usually scheduled events that no one is baby-sitting, then how would the Raise Error get any user input (assuming some is needed)?



Catadmin - MCDBA, MCSA
"No, no. Yes. No, I tried that. Yes, both ways. No, I don't know. No again. Are there any more questions?"
-- Xena, "Been There, Done That"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top