none
Converting String Variable to Integer in SSIS RRS feed

  • Question

  • Hi,

    I am trying to convert a string variable to integer in SSIS using the expression task.

    @[User::Nummer] = (DT_I4) @[User::Name]

    But I get an error that the conversion from (DT_WSTR) to (DT_I4) is not possible!!

    Wednesday, May 20, 2015 8:34 AM

Answers

  • Hi ganeshsg,

    According to your description, you get an error message when you convert a string variable to integer variable.

    In SQL Server Integration Services, it supports convert an expression from DT_WSTR data type to DT_I4 data type. Please note that the values returned by the expression should be numeric values at design time and run time.

    So in your scenario, please verify the value in the @[User::Name] is numeric value at design time and run time.

    Reference:
    Cast (SSIS Expression)

    Thanks,
    Katherine Xiong


    Katherine Xiong
    TechNet Community Support

    Thursday, May 21, 2015 9:35 AM
    Moderator

All replies

  • Hello,

    When are you getting the error, during design or during runtime of the package?


    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Wednesday, May 20, 2015 9:03 AM
  • Hi ganeshsg,

    According to your description, you get an error message when you convert a string variable to integer variable.

    In SQL Server Integration Services, it supports convert an expression from DT_WSTR data type to DT_I4 data type. Please note that the values returned by the expression should be numeric values at design time and run time.

    So in your scenario, please verify the value in the @[User::Name] is numeric value at design time and run time.

    Reference:
    Cast (SSIS Expression)

    Thanks,
    Katherine Xiong


    Katherine Xiong
    TechNet Community Support

    Thursday, May 21, 2015 9:35 AM
    Moderator