Hi All,
I'm very new to Integration Services. Self Learned this ETL tool based on my prior ETL tool knowledge.
Can you tell me how do write IF Then Else conditions for every column in my source and redirect to a single output?
Hey correction here ... i'm using flat file as my source
Thanks in Advance,
Suresh N
It would help if you could provide a more explicit example of the type of logic you're hoping to implement, but here is a response based on my best guess at what you're trying to accomplish.
FIrst, start with the Derived Column transformation in your data flow: http://msdn2.microsoft.com/en-us/library/ms141069.aspx. This transform is the tool of choice for adding new columns - including new columns based on conditional logic and the values in existing columns - to your data flow.
Next, build an expression using the SSIS conditional operator to implement the If Then Else logic you need: http://msdn2.microsoft.com/en-us/library/ms141680.aspx.
You can also use the Script Transformation to perform more complex If Then Else logic in the data flow, but I personally try to avoid this if I can, as it makes your packages more difficult to maintain.
Please let us know if this gives you what you need.
|||Thanks for reply Matthew.
I'm not able to do. Still needed help.
I have a flat file as a source, for each column i need to detect for NULL values. If it is NULL then i need to populate "99" Else Value.
I'm trying the same in Derived column transformation, not succeeded.
Do SSIS have something where i could write If Then Else ?
thanks..
Suresh N
|||Suresh,
You can use a derived column transformation in the data flow with an conditional expression like
ISNULL(column1) ? 99 : column1
http://msdn2.microsoft.com/en-us/library/ms137538.aspx
|||
Suresh N wrote:
Thanks for reply Matthew.
I'm not able to do. Still needed help.
I have a flat file as a source, for each column i need to detect for NULL values. If it is NULL then i need to populate "99" Else Value.
I'm trying the same in Derived column transformation, not succeeded.
Do SSIS have something where i could write If Then Else ?
thanks..
Suresh N
This is exactly what the Derived Column transform is designed to do. Can you please post some specific information about what you are doing and what results you're seeing. There's not a lot of helpful information in your post to assist in troubleshooting.
|||Hi Rafael,
Thanks much for your answer.
This has made my job done.
Regards,
Suresh N
|||If you have to do this for several files accross a couple of packages then this when I think you should consider a custom transform. Faster development and maintenance as well as the ability to control custom business rules in a single (external to packages) assembly. The use of 99 in a local business rule I believe.
No comments:
Post a Comment