Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Data Flow Task gives Truncation may occur

Author  Topic 

jbates99
Constraint Violating Yak Guru

396 Posts

Posted - 2013-06-17 : 20:42:11
Hi experts,

I have a problem that's making me crazy. This Data Flow has a Flat File source and an OLE DB table as the destination. The source text file has fixed width columns.

Validation warning. Data Flow Task: Truncation may occur due to inserting data from data flow column "RecordID" with a length of 255 to database column "RecType" with a length of 1.

Any ideas? Thanks, Jack

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-18 : 00:42:09
the error message is obvious. Your SSIS package has a mapping between RecordID column from source which is of length 255 to RecType field which just has length of 1. This can be a potential cause for value truncation which is what SSIS complains about.


If source is a flat file it usually takes length as 255 by default for text data. So the solutions are
1. Add a derived column in between source and destination (flat file source and oledb table) and add an expression to take only first character. You should do this only if you're sure the source field will have only one character data always
2. Another way is to go to advanced properties of flat file and chage it as per your business rule (ie if you're certain it can contain only 1 character make it 1

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

jbates99
Constraint Violating Yak Guru

396 Posts

Posted - 2013-06-18 : 09:25:47
visakh16, thanks for your idea.

I wish it were so easy. I had already changed the Flat file Connection by setting the correct Input Column Width for each column. And the Preview window shos everything correctly, all columns. No columns are defined as length 255. I don't know why I'm getting
Validation warning. Data Flow Task: Truncation may occur due to inserting data from data flow column "RecordID" with a length of 255 to database column "RecType" with a length of 1.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-06-18 : 10:13:36
then try the derived column method.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -