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)
 SSIS and 8000 chars

Author  Topic 

rohitkumar
Constraint Violating Yak Guru

472 Posts

Posted - 2010-03-05 : 10:59:30
I have to load a .txt file to a table with one of the columns > 8000 chars, it would be fine to trim the column to first 8000 chars while loading.

How should I do this?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-05 : 12:22:41
use a derived column task to tril the column value using SUBSTRING() function

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

rohitkumar
Constraint Violating Yak Guru

472 Posts

Posted - 2010-03-05 : 13:46:32
I tried it, am geting this

The result string for expression "SUBSTRING(MyCol,1,8000)" may be truncated if it exceeds the maximum length of 4000 characters. The expression could have a result value that exceeds the maximum size of a DT_WSTR.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-05 : 13:49:23
whats the datatype of myCol?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

rohitkumar
Constraint Violating Yak Guru

472 Posts

Posted - 2010-03-05 : 13:53:40
its String [DT_STR] 8000
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-05 : 13:55:19
and destination column datatype?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

rohitkumar
Constraint Violating Yak Guru

472 Posts

Posted - 2010-03-05 : 13:56:53
varchar(max)
Go to Top of Page

rohitkumar
Constraint Violating Yak Guru

472 Posts

Posted - 2010-03-05 : 14:19:30
I guess ignoring truncation failure at the txt file connection is the only way out.
Go to Top of Page
   

- Advertisement -