Data Transformation problem in SSIS

  • Hi:

    I am new to SSIS and SQL Server. I have a package that copy data from source table to destination table. In the source table I have column name 'ID' data type 'varchar'. the data in this column is something like this 'A123423'.

    In the destination table i have column 'ID' data type 'int' with a primary key. I can't able to copy data from source to destination because of the character with the number. how can i transform the data from source to destination in SSIS package.

    thanks

  • You can't convert string (varchar) columns to numeric (int), your options are:

    a. introduce a numeric (int) column in your target table, or

    b. exclude the ID column from your transformation, or

    c. get the numeric value of your source ID column from its second character.

    Hope this helps,
    Rock from VbCity

  • Grass (6/27/2012)


    Hi:

    I am new to SSIS and SQL Server. I have a package that copy data from source table to destination table. In the source table I have column name 'ID' data type 'varchar'. the data in this column is something like this 'A123423'.

    In the destination table i have column 'ID' data type 'int' with a primary key. I can't able to copy data from source to destination because of the character with the number. how can i transform the data from source to destination in SSIS package.

    thanks

    Can not store string in int data type.

    However in any case if you want to copy the data, split the character and numeric value and add a column to destination table to store the character part.Later to get the ID from destination table you can concatenate both the columns by converting int value to varchar.

    --rhythmk
    ------------------------------------------------------------------
    To post your question use below link

    https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help
    🙂

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

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