Derived Column Editor

Posted by Rob Bowman on Stack Overflow See other posts from Stack Overflow or by Rob Bowman
Published on 2010-06-08T10:03:39Z Indexed on 2010/06/08 10:22 UTC
Read the original article Hit count: 373

Filed under:

Hi

I need to assign a formatted date to a column in a data flow. I have added a Derived Column editor and entered the following expression:

"BBD" + SUBSTRING((DT_WSTR,4)DATEADD("Day",30,GETDATE()),1,4) + SUBSTRING((DT_WSTR,2)DATEADD("Day",30,GETDATE()),6,2) + SUBSTRING((DT_WSTR,2)DATEADD("Day",30,GETDATE()),9,2)

The problem is that the "Derived Column Transformation Editor" automatically assigns a Data Type of "Unicode string[DT_WSTR]" and a length of "7". Howver, the length of a string is 11, therefore the following exception is thrown each time:

[Best Before Date [112]] Error: The "component "Best Before Date" (112)" failed because truncation occurred, and the truncation row disposition on "output column "Comments" (132)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.

Does anyone know why the edit is insisting on a length of 7? I don't seem to be able to change this.

Many thanks,

Rob.

© Stack Overflow or respective owner

Related posts about ssis