2

I am creating a derived column in SSIS to pull last date of year for 2012. What would the expression look like?

LastDateofYear attribute in date data type

Hadi
  • 36,233
  • 13
  • 65
  • 124

1 Answers1

1

Since always the last day is 31/12 then you can concatenate a string to the year part and convert it to DT_DATE data type using a derived column:

(DT_DATE)"2012-12-31"

If the year is a variable:

(DT_DATE)((DT_WSTR,10)@[User::year] + "-12-31")
Hadi
  • 36,233
  • 13
  • 65
  • 124
  • Hi Hadi - the Derived Column Transformation Editor does not have the "DT_Date" expression available. Under Date/Time functions, I have DATEPART, YEAR, OR GETDATE available. Could one of those work? – Starbrite420 Jul 05 '19 at 20:16
  • 1
    @Starbrite420 dt_date is not a datetime function it is a data type cast function https://learn.microsoft.com/en-us/sql/integration-services/expressions/cast-ssis-expression?view=sql-server-2017 – Hadi Jul 05 '19 at 21:07