Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How do I do an inner join where the join conditions are not equal in SSIS?


How do I do an inner join where the join conditions are not equal in SSIS?

Author
Message
sarah.cook
sarah.cook
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 17
Hi,

I've been trying to figure out an elegant way to do a merge join in SSIS where the join conditions are not equal... I know there an easy solution that's just escaping me right now, and I can't find anything on the net...

Any help would be appreciated Smile

I basically have one dataflow with values and amounts:
code min max
1 0 100
2 101 200
3 201 300

And a table where I need to lookup or join to get the right code for each record:
ac value code
1 135
2 55
3 65
4 201

etc....

In sql, I woudl just to an inner join where value >= min and value <= max but I can't see how to do this in ssis.

Thanks
sqlnaive
sqlnaive
Hall of Fame
Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)

Group: General Forum Members
Points: 3687 Visits: 2774
I'm just going through the basics in SSIS, but can you try lookup transformation ?
Koen Verbeeck
Koen Verbeeck
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16463 Visits: 13207
This article explains how you can do a range lookup with SSIS:

Lookup Pattern: Range Lookups



How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at SQLKover.

MCSA SQL Server 2012 - MCSE Business Intelligence
sarah.cook
sarah.cook
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 17
Thanks very much for your reply. Very helpful.

Looks like there's no real elegant way to do this (besides going through teh trouble to write a custom script) although I think I'll try the Merge Join - Conditional split.

It's really too bad SSIS doesn't support this in a regular Merge Join component...

In playing around, I have been just saving the values to a Temp table, and then doing my own update in the Control flow where I can then write in the sql code for the join, but this just breaks up all the processing and is really a work around.

Thanks!!
Sarah
Phil Parkin
Phil Parkin
SSCrazy Eights
SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)SSCrazy Eights (8.4K reputation)

Group: General Forum Members
Points: 8381 Visits: 19501
sarah.cook (8/23/2013)
Thanks very much for your reply. Very helpful.

Looks like there's no real elegant way to do this (besides going through teh trouble to write a custom script) although I think I'll try the Merge Join - Conditional split.

It's really too bad SSIS doesn't support this in a regular Merge Join component...

In playing around, I have been just saving the values to a Temp table, and then doing my own update in the Control flow where I can then write in the sql code for the join, but this just breaks up all the processing and is really a work around.

Thanks!!
Sarah


That may be so, but doing joins using the SQL Server engine is much faster than doing them in SSIS. So it may feel like a workaround, but perhaps if you instead consider it as a performance optimisation things won't seem so bad :-)


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

If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Please surround any code or links you post with the appropriate IFCode formatting tags. It helps readability a lot.
Koen Verbeeck
Koen Verbeeck
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16463 Visits: 13207
Phil Parkin (8/25/2013)

That may be so, but doing joins using the SQL Server engine is much faster than doing them in SSIS. So it may feel like a workaround, but perhaps if you instead consider it as a performance optimisation things won't seem so bad :-)


If the data is already sorted, SSIS isn't necessarily slower for large data sets.
If the data is sorted. :-)



How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at SQLKover.

MCSA SQL Server 2012 - MCSE Business Intelligence
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search