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.
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 MVPhttp://visakhm.blogspot.com/ |
 |
|
rohitkumar
Constraint Violating Yak Guru
472 Posts |
Posted - 2010-03-05 : 13:46:32
|
I tried it, am geting thisThe 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. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-03-05 : 13:49:23
|
whats the datatype of myCol?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
rohitkumar
Constraint Violating Yak Guru
472 Posts |
Posted - 2010-03-05 : 13:53:40
|
its String [DT_STR] 8000 |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-03-05 : 13:55:19
|
and destination column datatype?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
rohitkumar
Constraint Violating Yak Guru
472 Posts |
Posted - 2010-03-05 : 13:56:53
|
varchar(max) |
 |
|
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. |
 |
|
|
|
|