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)
 How i can convert TEXT to VARCHAR

Author  Topic 

Sonu619
Posting Yak Master

202 Posts

Posted - 2011-01-12 : 21:20:54
Simple package giving me very hard time.
SOURCE = CSV FILE
TARGET = OLE DB

every time i run package right away gives me 'RED COLOR' Please help me out how i can convert TEXT to VARCHAR in 'DERIVED COLUMN' I tried through 'DATA CONVERSION TRANSFORMATION" still didn't work out. Thanks in advance.

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2011-01-12 : 21:50:07
TEXT from an excel file is seen as NVARCHAR. Annoying, but there is a difference between unicode and non-unicode. Change the destination to nvarchar if you can. If need be load into a staging table with nvarchar, and then insert into the final destination from there. By far one of the most irritating things to deal with in SSIS when importing from excel and even MS Access



Poor planning on your part does not constitute an emergency on my part.

Go to Top of Page

Sonu619
Posting Yak Master

202 Posts

Posted - 2011-01-12 : 22:17:27
Thanks for your tip, Here is the error that i am getting if i use any field,

[Flat File Source [14]] Error: The "output column ""COMP_TYPE"" (257)" failed because truncation occurred, and the truncation row disposition on "output column ""COMP_TYPE"" (257)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.
Go to Top of Page

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2011-01-13 : 06:58:41
That means your destination column is too short. If you are certain that the field is not being cut off (this is pretty common with excel imports), you can turn off the truncation error in the error output from the source. Otherwise, make the destination column bigger. This is basic stuff.



Poor planning on your part does not constitute an emergency on my part.

Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-01-13 : 08:45:29
Also, in the data transformation task, you can change the output data type.
Go to Top of Page

Sonu619
Posting Yak Master

202 Posts

Posted - 2011-01-14 : 22:18:26
I want to give you update the problem was in Text and Date Data Type field, I transfer one by one to check where is the problem, I fixed data field but still working on TEXT field. How to covert Text to varchar. I will keep you update if some one want to know the function i will upload it. Thanks for your help.
Go to Top of Page
   

- Advertisement -