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

SSIS 2012 Lookup not considering duplicate records from reference dataset Expand / Collapse
Author
Message
Posted Saturday, May 10, 2014 12:36 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, June 18, 2014 4:24 PM
Points: 27, Visits: 122
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.
Post #1569546
Posted Saturday, May 10, 2014 1:11 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 9:26 AM
Points: 1,226, Visits: 3,571
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.
Post #1569548
Posted Sunday, May 11, 2014 1:45 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, June 18, 2014 4:24 PM
Points: 27, Visits: 122
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.
Post #1569650
Posted Friday, May 16, 2014 10:28 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, June 27, 2014 2:05 PM
Points: 300, Visits: 810
You can get around this by making your source a query that joins to that reference table.
Post #1571813
Posted Friday, May 16, 2014 10:55 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, June 18, 2014 4:24 PM
Points: 27, Visits: 122
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.
Post #1571822
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse