handling nomatch output from Lookup in SSIS

  • 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.

  • 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.

  • 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

  • Anyone have any suggestions? thanks for your time.

  • 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.

  • 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).

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply