SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SSIS 2012 Lookup not considering duplicate records from reference dataset


SSIS 2012 Lookup not considering duplicate records from reference dataset

Author
Message
Nilesh-788004
Nilesh-788004
SSC Veteran
SSC Veteran (240 reputation)SSC Veteran (240 reputation)SSC Veteran (240 reputation)SSC Veteran (240 reputation)SSC Veteran (240 reputation)SSC Veteran (240 reputation)SSC Veteran (240 reputation)SSC Veteran (240 reputation)

Group: General Forum Members
Points: 240 Visits: 140
I am using SSIS 2012, SQL Server 2012 both for source and destination.This is in regards loading a fact table.
I am using a Lookup and that Lookup table has values like.

Store table
storekey StoreNum PSLocationKey
923 14120 500
1753 14120 500

From the source I am Pulling StoreNum and Looking up using the StoreNum "ONLY" and returning StoreKey and LocationKey from the Lookup and loading it into the fact table. In the above case I want to load both the records from the lookup table as I am joining on StoreNum.But only the 1st record gets loaded.As if the second record does not gets considered at all. if I interchange the order of the records in the Lookup table only the 1st record from Lookup table gets considered.I did try using SQL in the Looup transformation and hard code using UNION ALL.Did try various cache options. Also tried Lookup Property Considering Duplicate records as error TRUE/FALSE.No effect.
I read a post [url=http://blogs.msdn.com/b/michen/archive/2008/06/07/lookup-multiple-rows.aspx][/url].But this dates back to year2008.

The other alternative I tried using multicast transformation and 2 looksup transformation.Each Lookup has 1 of the records and it works.I can see both the records in the pipeline.But what if there are 3 records or 4 records of such type.I cannot dynamically add Lookup transformation.

The only option for me is to use SQL Command and variables in source. But this defeats the purpose of SSIS.

Please sugesst me how can I implement this only with 1 Lookup transformation.
Eirikur Eiriksson
Eirikur Eiriksson
SSC-Forever
SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)

Group: General Forum Members
Points: 41102 Visits: 19488
Nilesh-788004 (5/10/2014)
I am using SSIS 2012, SQL Server 2012 both for source and destination.This is in regards loading a fact table.
I am using a Lookup and that Lookup table has values like.

Store table
storekey StoreNum PSLocationKey
923 14120 500
1753 14120 500

From the source I am Pulling StoreNum and Looking up using the StoreNum "ONLY" and returning StoreKey and LocationKey from the Lookup and loading it into the fact table. In the above case I want to load both the records from the lookup table as I am joining on StoreNum.But only the 1st record gets loaded.As if the second record does not gets considered at all. if I interchange the order of the records in the Lookup table only the 1st record from Lookup table gets considered.I did try using SQL in the Looup transformation and hard code using UNION ALL.Did try various cache options. Also tried Lookup Property Considering Duplicate records as error TRUE/FALSE.No effect.
I read a post [url=http://blogs.msdn.com/b/michen/archive/2008/06/07/lookup-multiple-rows.aspx][/url].But this dates back to year2008.

The other alternative I tried using multicast transformation and 2 looksup transformation.Each Lookup has 1 of the records and it works.I can see both the records in the pipeline.But what if there are 3 records or 4 records of such type.I cannot dynamically add Lookup transformation.

The only option for me is to use SQL Command and variables in source. But this defeats the purpose of SSIS.

Please sugesst me how can I implement this only with 1 Lookup transformation.


My first thought is that you will have to feed distinct StoreNum PSLocationKey into the Lookup, it doesn't like Cartesian Product in the output.
Cool
Nilesh-788004
Nilesh-788004
SSC Veteran
SSC Veteran (240 reputation)SSC Veteran (240 reputation)SSC Veteran (240 reputation)SSC Veteran (240 reputation)SSC Veteran (240 reputation)SSC Veteran (240 reputation)SSC Veteran (240 reputation)SSC Veteran (240 reputation)

Group: General Forum Members
Points: 240 Visits: 140
The store records have different effectivefrom and EffecttiveTodate. I ahve to load data that matches both the records in my facts.So if the user selects date that is within the 1st store range.It will show data for 1st record else the second store record. I cannot achieve this through lookup is it because it is syncronous.It Does not produce multiple records.
herladygeekedness
herladygeekedness
Ten Centuries
Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)

Group: General Forum Members
Points: 1354 Visits: 813
You can get around this by making your source a query that joins to that reference table.
Nilesh-788004
Nilesh-788004
SSC Veteran
SSC Veteran (240 reputation)SSC Veteran (240 reputation)SSC Veteran (240 reputation)SSC Veteran (240 reputation)SSC Veteran (240 reputation)SSC Veteran (240 reputation)SSC Veteran (240 reputation)SSC Veteran (240 reputation)

Group: General Forum Members
Points: 240 Visits: 140
That's what I am forced to do.I wish Lookup could handle that.We cannot use variable in Lookup transformation.
Will also try with LOOKUP PLUS from Codeplex.
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