Having difficulty with mismatch of string lengths

Venkat Venkataramanan 76 Reputation points


I am using Visual Studio v19. In my integration project, I have a database field defined as VARCHAR(6).

The variable, myField, is defined as string. This defaults to DT_STR of length 10.
The database column is defined as varchar(6).
When I map these two, I get a warning because of the length mismatch.
I have tried using LEFT(myField, 6) results in a DT_STR of length 4. The same is the result when I use the CAST operator.

How can I convert my variable, myField to DT_STR(6)?


SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,451 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Monalv-MSFT 5,891 Reputation points

    Hi @Venkat Venkataramanan ,

    Please use the following expression in Derived Column Transformation :


    The following pictures will be helpful:




    Best Regards,


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    Hot issues in November--What can I do if my transaction log is full?
    Hot issues in November--How to convert Profiler trace into a SQL Server table?