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 2005 Forums
 SSIS and Import/Export (2005)
 Truncate Error

Author  Topic 

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-03-13 : 15:26:20
Hi, I have a package with a OLE DB source and Flat File Destination.

The ZIP Code is stored as '07034-1714' with Char(10) in the table.

but in the falt file the field is of char(9). The zip code should appear as 070341714 in the file.

So I used a Derived column in between and used

REPLACE(ADDR_ZIP,"-","") and saved this value to a new column with length 9. When I run the package it errored out saying truncation has occurred. How do I get over this?

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-03-13 : 16:02:16
Although I dint want to do it, I used SUBTRING on top of the replace and it worked fine now.

SUBSTRING(REPLACE(ADDR_ZIP,"-",""),1,9)
Go to Top of Page
   

- Advertisement -