Search code examples
sql-serverssisetlssis-2012derived-column

Change data length using SSIS DerivedColumn


I´m reading .csv file to paste into sql table but I get advertesiment into a column

enter image description here

It occurse because my destination table have "MOLDE" with string(50) and source have string(255)

How can I change "MOLDE" length to get only 50 first values

So I create derived column and I try to use substring, but it keep getting length 255 enter image description here

What can I do there?. Regards

----UPDATE----

I´m resolve it as answer comment but I still getting Advertisiment Icon like this: enter image description here

Is it posible to remove it?


Solution

  • Try casting to DT_STR with length equal 50

    (DT_STR,50,1252)SUBSTRING(MOLDE,1,50)
    

    OR

    (DT_STR,50,1252)LEFT(MOLDE,50)
    

    Note that you have to map the derived column to the destination instead of the original column , if warning still appearing just double click on the destination to refresh metadata

    Reference

    UPDATE 1

    After reading your comment i think the warning still appearing because you have selected derived column option to replace the original column which caused this conflict, just change the option Replace 'MOLDE' to Add New Column and map the derived column to the destination column.

    Or make sure that the destination is reading MOLDE column from the derived column component not the Source column, openning Destination with advanced editor may help.