|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Friday, October 05, 2012 1:24 AM
Points: 63,
Visits: 261
|
|
Wanted to use lookup transformation for the following: - Pull records from oledb source - Lookup in oledb destination first to see if record exists - if record does not exist, send to destination as insert.
The result just dumps everything into the destination when the Destination is Empty(In my case it is a blank table in the starting)
I have tried no cache option also but thats not working too...as there are duplicates...
I don't want any duplicates in my loookup column....
PLEASE HELP...THIS IS KILLING ME
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Friday, October 05, 2012 1:24 AM
Points: 63,
Visits: 261
|
|
The only solution I have found till now is this
I am sending this data to a temp table instead of sending it to a Destination table and then I have created one more data flow task for doing SELECT DISTINCT FROM TEMP TABLE.
Let me know if there is a better way to do this.
|
|
|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: 2 days ago @ 6:30 AM
Points: 9,410,
Visits: 6,495
|
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Thursday, May 23, 2013 9:02 PM
Points: 323,
Visits: 804
|
|
This is simple.. You have to use a SORT transformation and de-duplicate on LOOKUP columns.
You can remove duplicates either before using lookup Tx or after that before inserting into your destination.
---------------------------------------------------
Thanks
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Friday, October 05, 2012 1:24 AM
Points: 63,
Visits: 261
|
|
| I am sorry ssis learner..But, I didn't understand how Ican achieve this by sort transformation
|
|
|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: 2 days ago @ 6:30 AM
Points: 9,410,
Visits: 6,495
|
|
da-zero (8/20/2010) Where exactly are there duplicates? In your source or at the destination?
If there are duplicates at the source, performing a lookup while you are writing to the table destination will not work perfectly, as you are inside a transaction. I think the best method is making sure you write a good SQL SELECT statement to get the data in the OLE DB Destination so that there are no duplicates to begin with.
That is actually one of the worst things you can do (it works though), as the SORT component is a blocking component. If your source contains 1 million rows, you'll have to load them all in memory and then sort them. There are much better alternatives that don't hit performance so hard.
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 LessThanDot.
 MCSA SQL Server 2012 - MCSE Business Intelligence
|
|
|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: 2 days ago @ 6:30 AM
Points: 9,410,
Visits: 6,495
|
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Yesterday @ 3:46 PM
Points: 5,870,
Visits: 4,893
|
|
I have done this before with SSIS 2005, it is easier with SSIS 2008..
In the Lookup comopnent for 2005 you have 2 outputs, found and error. In 2005 I have generally used the error to indicate NOT found and use that for inserts, where I use the found as updates. You can get it to do this by setting the error as redirect.
Is that clear?
In SSIS 2008 there is three outputs, found, not found, and error.. much better.
CEWII
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Friday, October 05, 2012 1:24 AM
Points: 63,
Visits: 261
|
|
Thanks to Elliott and everyone who reponded.
Here is a brief description of my problem
Initially my destination(reference) table is empty... I am trying to load data from my staging table into a Customer Dimension table(dimension table so, each customer will have only one record with their customer no, name etc )...
Here is my sample input data from staging
custName CustNumber Custemail CustLocation CustLocNumber A 1 XX H 1 A 1 XX D 2 B 2 YY M 3 B 2 YY C 4 C 3 ZZ B 5
And Here is my customer Dimension Table(My destination&Refernce Table)(and this is empty)
CustName CustNumber Custemail
So, when I look up CustNumber in both these table since there is no data in the reference table everything goes to the NO MATCH OUTPUT. Since these are new records I want to insert these records into the Destination(Ref) table. But, when I do this all my records are getting inserted into the Dim table like
custName CustNumber Custemail A 1 XX A 1 XX B 2 YY B 2 YY C 3 ZZ
IS there a way I can get a result in Dimension table like
custName CustNumber Custemail A 1 XX B 2 YY C 3 ZZ
Let me know if I am confusing you again.
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Yesterday @ 3:46 PM
Points: 5,870,
Visits: 4,893
|
|
I'd probably change my select query from the staging and do a distinct and only include the fields I needed. This should weed out dupes and make the database engine to the work for you without making SSIS do it.
CEWII
|
|
|
|