Compare 2 column for an sql table in ssis package using derived column control

Posted on 2009-02-23
Last Modified: 2013-11-10
I have two columns in my derived table and i want to compare both of these columns and want ti update the third column based on the result.
I am using the Derived column control to do this: One column is is NewDateCommonformat and second one is GetDateFormat, and the column to be updated is Status
NewDateCommonFormat < GetDateCommonFormat && Status == "R" ? Status == "R" : Status == "P"

That is if newdateformat<getdatecommonformat and status='R' then

status should remain as R otherwise change it to P
But this is not working ........i dont know if i have my conditions rite here?
Please can somebody help me if the expression for the derived column used above is correct??

Also at derived column editor m entering below info:
also at Derived column name m saying: status
and Derived column i am mentioning: Replace Status
and Expression: The expression used above to compare 2 columns and update the 3rd column.

Thansk everyone :) needed it urgently
Question by:passion420
    LVL 25

    Expert Comment

    'Status == "R" : Status == "P"'

    Isn't == the comparison operator and = the assignment operator?

    I believe it should be like this, but stand to be corrected..

    NewDateCommonFormat < GetDateCommonFormat && Status == "R" ? Status = "R" : Status = "P"


    Author Comment

    I tried that but it says an error: an error at data flow task,  The qual sign at line was not expected, double equal sign may be required at the location specified. also Failed to set property "expression" on input column "status".  
    LVL 25

    Accepted Solution

    Try leaving the Status out of the assignment like -

    NewDateCommonFormat < GetDateCommonFormat && Status == "R"? "R" : "P"


    Featured Post

    PRTG Network Monitor: Intuitive Network Monitoring

    Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

    Join & Write a Comment

    I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
    For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
    Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
    Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now