SSIS Derived column giving error on CAST function I am trying to use (DT_DATE) DATEADD(dd, -1, GETDATE()) in a derived column. However, by the time I can start writing my expression with (DT_DATE) it turns red and shows an error. Whether it's just (DT_DATE) sitting there or the full expression it throws an error.

Here is a screen shot of the error 

Also:


If I remove this one derived column expression the rest of my package works fine, including a different derived column
All I'm doing is taking an Excel file, adding two derived columns to it, then putting into an SQL database


Basically it seems to not want to accept (DT_DATE). I'm sure I'm making some small error here but I've tried everything I can think of and any help would be greatly appreciated.
You are not using the expression you are showing in your question as evidenced by the error message.


  Attempt to parse the expression "(DT_DATE)DATEADD(DAY,-1GETDATE())"
  failed and returned an error


Your expression with problems is the one for Batch_as_of_Date

(DT_DATE)DATEADD(DAY, -1, GETDATE())


If you don't put double quotes around the first argument SSIS tries to parse it as a column. Since you don't have a DAY column in your input columns so you get this error message:


  Attempt to find the input column named "DAY" failed ....


So your expression would need to be

DATEADD("Day", -1, GETDATE())


This is clearly documented in DATEADD (SSIS Expression)