Truncation warnings: varchar(10) to char(3)
Hi How to fix this warning? I already posted this question but; it is not resolved , so Iam positing it again. Warning 12 Validation warning. {B26AF6F7-196D-4E21-8ABA-0EBCCB59BCF5} tbl_trans [71693]: Truncation may occur due to inserting data from data flow column "cntry_code_value" with a length of 10 to database column "cntry_code" with a length of 3. testpkg.dtsx 0 0 I tried with SUBSTRING ; (DT_STR,3,1252) in derivedcolumn transformation and even on select qry with CONVERT(3) but I keep on having this Warning. I tried to set this truncation warning to "Ignore" in derived column Configure Err Output but the warnings are still there!!! Please help me out. I have to get rid of these warnings!!!
March 30th, 2010 1:36am

Do you understand why you're receiving these warnings?
Free Windows Admin Tool Kit Click here and download it now
March 30th, 2010 2:21am

Sorry ! I don't understand why I have this error. (I stared this thread beore I had any reply today; now on I don't post on other thread)
March 30th, 2010 2:35am

Walk through this with me. cntry_code_value is how long? cntry_code is how long?
Free Windows Admin Tool Kit Click here and download it now
March 30th, 2010 3:05am

okay, cntry_code_value :varchar(10): but value is 3 long and cntry_code is: char(3) and value is 3 long
March 30th, 2010 3:16am

What you are trying to do is drive a car 10 feet wide into a garage that's only 3 feet wide. Doesn't matter if the car only has three people in it. Get it?
Free Windows Admin Tool Kit Click here and download it now
March 30th, 2010 3:43am

Could you please tell me how to fix this?
March 30th, 2010 5:03am

You have to either increase the width of the destination column Cntry_Code (to 10 in your case) or change the length of the output column (to 3 in your case) using Advanced Editor for the source.Nitesh Rai- Please mark the post as answered if it answers your question
Free Windows Admin Tool Kit Click here and download it now
March 30th, 2010 5:14am

Yes you are right, I converted to length of 3 during my transformation. but I still have the warning.
March 30th, 2010 5:33am

No - you haven't converted it to a length of 3. You've just made sure you kicked out passengers if there were more than 3 of them. Your car is still 10 feet wide. You need to move your passengers out of the 10 foot wide car into a 3 foot wide one. Inside your Derived Column, don't "replace" the existing column - create a new one. You'll have to call it something different.
Free Windows Admin Tool Kit Click here and download it now
March 30th, 2010 5:45am

Okay.. I will make this very clear: I tried using derived column : Derived column name: new_cnty_code Derived Column:< add new column> Expression:(DT_STR, 3 ,1252)cntry_code .. tell me if there is any other way?
March 30th, 2010 6:15am

In expression you need to use SUSBTRING function to fetch first 3 characters. The expression you wrote is throwing error becasue you are trying to put a value of width 10 units to a column with available width as 3 units (exactly same as the car and garage example given by Todd ).Nitesh Rai- Please mark the post as answered if it answers your question
Free Windows Admin Tool Kit Click here and download it now
March 30th, 2010 6:22am

Okay I tried using the way you are telling: Expression:(DT_STR, 3 ,1252)substring(cntry_code,1,3) is this correct?
March 30th, 2010 6:28am

It should be - but you should be able to tell us that, yes? Since you're not saying that it worked, I have to assume that it didn't. (It would be nice not to assume things - can you please put more in your posts?) What warnings or errors are you seeing now?
Free Windows Admin Tool Kit Click here and download it now
March 30th, 2010 6:41am

yes, I used the same expression: This the Warning 2 Validation warning. Data Flow Task: {4C3C11EF-4F7C-48C9-B6CD-67D78E028B84}: Truncation may occur due to inserting data from data flow column "new_cntry_code" with a length of 10 to database column "cntry_code" with a length of 3. Package1.dtsx 0 0 Warning 1 Validation warning. {4C3C11EF-4F7C-48C9-B6CD-67D78E028B84} OLE DB Destination [28]: Truncation may occur due to inserting data from data flow column "new_cntry_code" with a length of 10 to database column "cntry_code" with a length of 3. Package1.dtsx 0 0
March 30th, 2010 6:51am

Finally... I could able to fix this by having expression as : (DT_STR,2,1252)(DT_WSTR,2)cntry_code_value; Thank you Todd and Nitesh Rai !!
Free Windows Admin Tool Kit Click here and download it now
March 30th, 2010 8:01am

I'm glad you found a fix - but the above wasn't it. Good luck in the future.
March 30th, 2010 8:09am

I found this thread while searching for a way to eliminate truncation warnings. Even though I had chosen to replace a column in a Derived Column Transform using SUBSTRING(MyField,1,8) to try to get the field down to 8 characters, I was still receiving the truncation from 50 down to 8 warning at the destination. The package would run successfully, but the existence of a warning tells me I'm not doing it right. Todd's analogy of the car--and making sure it only holds 3 riders while not actually trimming down the size of the car itself--made complete sense and I was able to resolve my problem immediately. I chose to add a new column, not replace, and use the Advanced Editor to change the derived column output data type to that which I needed and BAM all my warnings just melted away. Thank you, Todd and Nitesh.
Free Windows Admin Tool Kit Click here and download it now
June 9th, 2011 4:56pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics