Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Conditional SSIS Tasks based on a result set? Expand / Collapse
Author
Message
Posted Tuesday, April 23, 2013 8:30 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, October 1, 2014 12:39 PM
Points: 200, Visits: 358
I have a source table with data that could go to multiple sources. For example, Apples, Oranges, Kumquats. I could write an Execute SQL Container to push the Apples to the Apples table. But each week, there may or may not be data for Apples in the source. I could write a script that only executes the sql if the records are there, but I wondered if there is SSIS way I could check and then skip the Data Flow task if there is no data to flow....

Does that make Sense?


Crusty
Post #1445473
Posted Tuesday, April 23, 2013 9:04 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 7:20 AM
Points: 5,180, Visits: 12,033
Have you checked out the Conditional Split transformation? It allows you to redirect data based on tests such as these, so you could split your input into multiple streams, with each stream going to a different output.


Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1445502
Posted Tuesday, April 23, 2013 9:59 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, October 1, 2014 12:39 PM
Points: 200, Visits: 358
Phil,

As always, thanks for your input, or.... Conditional Input... BUAH!!! LOL...

I checked this out and its totally cool; however, I have another question (just like a 6 y/o).. My conditional Column from the source table is called "Fruit" for this example. If the Condition says Fruit == "Apple" and I add my OLD DB Destination based on Apple, if there is no "Apple" Data to push, will the OLE DB Destination container fire off? If so, that's wasted processing time which I want to avoid. I have to do this 13 times. The Data Access Mode will be an SQL Command that queries the landing table with the source table to make sure no duplicates are pushed. The landing table is REALLY large in all cases and I need to limit how often/how long that table is getting hit as it has a direct impact on customers.

Also... I know this is stupid but why... why why why do we use single quotes to enclose a string everywhere else in SSMS, but in the conditional split conditions we use double quotes?

again... thanks for the assists... you always help if you can.

Crusty.
Post #1445549
Posted Tuesday, April 23, 2013 10:55 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 7:20 AM
Points: 5,180, Visits: 12,033
If no data is pushed along the output, the output will do no work. That is not to say that it won't be validated when the package fires, so there is a small overhead in having so many paths.

A possible problem for you is where your input file suddenly contains durians and kumquats and you have not built the conditions for directing these new fruits into your conditional split. If you need this type of dynamic processing, a different approach is required.

Regarding the double quotes - it's because SSIS is not based on T-SQL. The SSIS expression language is more like C# with some SQL-like functions added in. C# uses double quotes for string literals.



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1445581
Posted Tuesday, April 23, 2013 12:20 PM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Wednesday, October 1, 2014 12:39 PM
Points: 200, Visits: 358
Phil Parkin (4/23/2013)

A possible problem for you is where your input file suddenly contains durians and kumquats and you have not built the conditions for directing these new fruits into your conditional split. If you need this type of dynamic processing, a different approach is required.
.


YES! I knew you would see that. Durians, huh? Wow do they stink! Either way. The "Fruit" table is provided to us by a keying crew somewhere in Bangalore, India, thus if we get Durians, it's because we asked for it. If we got them without asking for it, there is a bigger problem. On that note, the team over there is pretty good.


Regarding the double quotes - it's because SSIS is not based on T-SQL. The SSIS expression language is more like C# with some SQL-like functions added in. C# uses double quotes for string literals


I thought it smelled like C something....ahhh... college days... that was a long time ago.


Ok. So I'll give it a shot and see what I get.

Thanks again, Dude.

P.S.... Did you know that Durians are outlawed on pubic transportation in some of the countries they are grown/imported?
Post #1445625
Posted Wednesday, April 24, 2013 1:50 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 7:20 AM
Points: 5,180, Visits: 12,033
P.S.... Did you know that Durians are outlawed on pubic transportation in some of the countries they are grown/imported?


Yep - with good reason too. I can't get near enough to one to ever consider tasting it!



Help us to help you. For better, quicker and more-focused answers to your questions, consider following the advice in this link.

When you ask a question (and please do ask a question: "My T-SQL does not work" just doesn't cut it), please provide enough information for us to understand its context.
Post #1445797
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse