compare columns ssis
You can do the following: Set up the Source component by using SQL and only selecting the columns you need. Connect the Source to a Lookup that contains SQL to again only pull the columns you need, but for the flag you can say: select parent_number, 1 as flag from table ... In the lookup you'd connect parent_number on the Columns tab and drag a connection from the Available Input Columns to the corresponding column on Available Lookup Columns. Please note that parent_number has to be the same data type on the Source and Lookup tables. On the General tab in the Lookup component, be sure to select Ignore Failure in the drop down box. After this you can connect the Lookup to a Derived Column transformation and <add as new column> one that is named Flag and in the Expression box you'll say " ISNULL(flag) ? 0 : flag " to handle Unmatched parent_number flags. Finally, you'll use a Destination component to update the Flag where Parent_Number exists. Good luck. PS. You could do it all in SQL which would be quicker, but I thought it might be more beneficial to your overall SSIS knowledge to know how different components work. Brian
January 21st, 2011 1:01am

Hello, Agreed with Brian, Just TSQL Code if you would like to go through that way.. CREATE TABLE #Table1 ( ParentID INT, NAME VARCHAR(30) ) GO INSERT INTO #Table1 VALUES (1, 'TEST1'), (2, 'TEST2'), (3, 'TEST4') GO CREATE TABLE #TParent ( ParentID INT, Name VARCHAR(30), Flg INT ) GO INSERT INTO #TParent (ParentID, Name) VALUES (1, 'TEST1'), (2, 'TEST2'), (3, 'TEST3'), (4, 'TEST4') GO SELECT * FROM #Table1 SELECT * FROM #TParent UPDATE A SET Flg = ( CASE WHEN A.ParentID = B.ParentID THEN 1 WHEN A.Flg IS NULL THEN 0 END ) FROM #TParent A LEFT JOIN #Table1 B ON A.ParentID = B.ParentID You can use update statement in Execute sql task in ssis to set your flg value. Thanks
Free Windows Admin Tool Kit Click here and download it now
January 21st, 2011 1:22am

i m new to this....i have a situation something like this....i know that there shud be an answer similar to this in these forums, but cudn't find it now coming to the situation. I have 2 tables. Now i am comparing table 1 (parent number) to table 2 ( parent number) and the moment i find a match, i wud update a column (flag) in table 1 with a flag 1(meaning i found it), if no match, update it with 0 ( meaning i didn't find it) How wud i do this in SSIS, cud somebody help me do this step by step plzThanks
January 21st, 2011 2:50am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics