0

I am trying to sum 2 columns (adjustment due day and expiration day):

DATEADD("dd",(DT_I4)AdjustmentDueDayCode,ExpirationDate)

I keep getting the following error message:

An error occurred while attempting to perform a type cast
SSIS Error Code `DTS_E_INDUCEDTRANSFORMFAILUREONERROR*`

I thought it could be because of nulls so wrote the following:

(DT_I4)AdjustmentDueDayCode > 0 ? (DATEADD("dd",

(DT_I4)AdjustmentDueDayCode,ExpirationDate) : "null"

But still getting the same error, any recommendations?

tambre
  • 4,625
  • 4
  • 42
  • 55
Rachel
  • 208
  • 1
  • 5
  • 18
  • Hi Rachel, May I have a couple of examples of rows of your data to view what your data looks like in the table, please? – Ryan Jun 15 '18 at 19:26
  • @Ryan sure, ExpirationDate : 1999-11-15 (date) AdjustmentDueDaycode : 90 (varchar(3)) – Rachel Jun 15 '18 at 19:41
  • Does DateAdd("dd", 90, ExpirationDate) work? How about (DT_I4)AdjustmentDueDayCode? Finally, does DATEADD("dd",((DT_I4)AdjustmentDueDayCode),ExpirationDate) work? – Brian Jun 15 '18 at 19:46
  • (DT_I4)AdjustmentDueDayCode Doesn't work and DateAdd("dd", 90, ExpirationDate) does work, so I guess the issue is casting Adjust.duedate – Rachel Jun 15 '18 at 19:55

1 Answers1

0

AdjustmentDueDaycode needs to become type BIGINT.

IE) DATEADD("dd", CONVERT(BIGINT, (DT_I4)AdjustmentDueDaycode),ExpirationDate)

Ryan
  • 3,475
  • 2
  • 16
  • 12
  • It won't let me change the data type of that column, gives me error : The value could not be converted because of a potential loss of data – Rachel Jun 15 '18 at 20:13
  • I changed the example to use BIGINT instead of INT in the conversion due to the DT_I4 data type. I hope it works for you! – Ryan Jun 15 '18 at 21:11