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

Posted on 2009-02-23
Medium Priority
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
  • 2
LVL 25

Expert Comment

ID: 23715058
'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

ID: 23715153
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

reb73 earned 2000 total points
ID: 23716047
Try leaving the Status out of the assignment like -

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


Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
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.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

612 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