Addy
Addy

Reputation: 36

SSIS Derived Column Date

enter image description here

I have notificationDate column. And I want LookUpDate column using derived column in SSIS.

which must look like 12-31-YEAR(NotificationDate)-1 So LookupDate column should be like "12-31-2014" or "12-31-2015"

This is what I am trying to do:

 "12" + "-" + "31" + "-" + YEAR( [NotificationDate]  )-1

Upvotes: 0

Views: 661

Answers (2)

Eric Brandt
Eric Brandt

Reputation: 8101

You'll have to explicitly cast your data types. The expression builder uses it's own syntax for that.

To concatenate a sting to build your date, you'll have to force the year to be a string value. Then, assuming your final output is supposed to be a date again, you'll wrap the whole concatenation in another explicit cast back to date.

This should be pretty close:

 (DT_DBTIMESTAMP)("12" + "-" + "31" + "-" + (DT_WSTR, 4)(YEAR(NotificationDate)-1))

Upvotes: 1

ASP
ASP

Reputation: 666

--Please try this. Make sure Column name you provided here exactly match (case senstive) with source column name

(DT_WSTR,6)("12-31-") + (DT_WSTR,4)(YEAR(NotificationDate) - 1)

Upvotes: 1

Related Questions