DTSTransformFlag_AllowStringTruncation -
12-30-2004
, 03:56 PM
Hello!
I'm trying to write VB code to create DTS package. The package will import
data from a delimited text file into a SQL table.
I need to ensure that the columns length in the text file do not exceed the
columns length in the sql table. If any column contain data with length
greater than allowed by the SQL table, I want the DTS package to fail.
When I set the DTSTransformFlags to DTSTransformFlag_Default, that includes
DTSTransformFlag_AllowStringTruncation, therefore if my data is too long in
the text file, it gets truncated then imported into the table. But this is
not what I want. I want the package to fail.
But when I take away DTSTransformFlag_AllowStringTruncation flag
(DTSTransformFlag_Default - DTSTransformFlag_AllowStringTruncation), the DTS
package always return error when executed, even when my data length is valid
in the text file.
The error is:
TransformCopy 'DirectCopyXform' validation error: AllowStringTruncation not
specified but possible for column pair 7 (source column 'Col007'
(DBTYPE_STR), destination column '<destination column 7 name>' (DBTYPE_STR))
TransformCopy 'DirectCopyXform' validation error: AllowStringTruncation not
specified but possible for column pair 4 (source column 'Col007'
(DBTYPE_STR), destination column '<destination column 4 name>' (DBTYPE_STR))
TransformCopy 'DirectCopyXform' validation error: AllowStringTruncation not
specified but possible for column pair 3 (source column 'Col007'
(DBTYPE_STR), destination column '<destination column 3 name>' (DBTYPE_STR))
TransformCopy 'DirectCopyXform' validation error: AllowStringTruncation not
specified but possible for column pair 2 (source column 'Col007'
(DBTYPE_STR), destination column '<destination column 2 name>' (DBTYPE_STR))
TransformCopy 'DirectCopyXform' validation error: AllowStringTruncation not
specified but possible for column pair 1 (source column 'Col007'
(DBTYPE_STR), destination column '<destination column 1 name>' (DBTYPE_STR))
Table Colum types and lengths are
1 varchar 3
2 varchar 10
3 varchar 30
4 varchar 30
5 varchar 50
6 varchar 50
7 varchar 2
All data in the text file has length a lot shorter than allowed and I only
have data in columns 1, 2, 3, 5, 7. So I don't know why DTS is picking on
coluns 1, 2, 3, 4, 7.
Does anyone has any idea? Maybe the DTSTransformFlag_AllowStringTruncation
flag only works in certain situations?
Thanks for your time
Conax |