Does anyone have a problem to type cast a string into an integer in expression builder

  • I have a variable defined as string and I want to change to integer in the expression builder.

    Variable - StartPeriod STRING -7

    In Expression

    SELECT (DT_WSTR,50)DATEADD("dd", DT_I8(@[USER::StartPeriod]), GETDATE())

    I got an error - Error occurred attempting from DT_WSTR to date type DT_I8

    How can I change from string to integer?

    Thanks

    BTW, I HATE SSIS :crazy:

  • Try this:

    1) add another variable of type Int64 (named as IntVar in this example)

    2) use expression to assign value to this variable (DT_I8) @[User::StartPeriod]

    3) change your expression to (DT_WSTR,50)DATEADD("dd", @[USER::IntVar], GETDATE())

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply