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

handling nomatch output from Lookup in SSIS Expand / Collapse
Author
Message
Posted Monday, July 30, 2012 1:18 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, September 10, 2012 10:40 AM
Points: 9, Visits: 33
Hi All,
I loaded my lookup values into a sql database. i am using lookup task to compare my source file column to lookup values in the sql database. My match output is fine however my no match output is Nulls for the lookup column. I want to capture the actual column value instead of null values. Can you please let me know how to achieve that. Thanks in advance.
Post #1337494
Posted Monday, July 30, 2012 2:23 PM
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
If I am understanding correctly, the field you are bringing into the flow via Lookup is null where there is no match (as it should be) but you wish for it to have a value, but that value cannot be found via lookup.

In which case you can use derived column component to change every row with Null in that field to Something Else of your choosing.

Post #1337540
Posted Monday, July 30, 2012 2:54 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, September 10, 2012 10:40 AM
Points: 9, Visits: 33
I think I confused everyone with my post. I apologize for that. So, I am posting here with a sample

My source file has data like below

PA,East,USA
CA,West,USA
FL,South,USA
WA,North,USA

and my lookup table in SQL database has the below information

Short_Name Long_Name
PA Pennsylvania
CA California
FL Florida

And I am using a lookup task to convert my column1 in the source file to Long_Name. When I execute my package my match output is like below (As expected)

Match Output from lookup
------- ------- ----- --------
Pennsylvania,East,USA
California,West,USA
Florida,South,USA

and my NoMatch output looks like below

,North,USA

What I am saying is if it wont find a match (in case of WA from sample data) I want to see my nomatch output as below
WA,North,USA

Appreciate your help. Tnx
Post #1337556
Posted Tuesday, July 31, 2012 10:41 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, September 10, 2012 10:40 AM
Points: 9, Visits: 33
Anyone have any suggestions? thanks for your time.
Post #1338042
Posted Tuesday, July 31, 2012 11:28 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, July 24, 2014 8:41 AM
Points: 2,818, Visits: 2,553
If you are actually using the No Match Output of the Lookup transform:
All of the columns in the input are generally available in the output regardless of match or no match. Are you looking at a Data Viewer for the results in your example, or at some saved output like a flat file or database table. If you are looking at a saved output, then you need to change your mapping to the output file.

If you are keeping the no match in the main data stream with all the other data then you need to evaluate the values and replace them with a derived column as herladygeekedness suggests. Something like
ISNULL(LongName)?ShortName:LongName
will return the ShortName when LongName is null and LongName otherwise.
Post #1338066
Posted Tuesday, July 31, 2012 2:22 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, September 10, 2012 10:40 AM
Points: 9, Visits: 33
I got it working. I havn't made any noticeable changes to my package. I created some data viewers to see the data flow in the package. Now my nomatch output is giving me the right data (WA,North,USA) instead of creating a blank for the column that doesnt have a lookup value in the reference dataset(,North,USA).
Post #1338175
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse