hex value in field/row terminator for bulk insert

Posted by TheObserver on Stack Overflow See other posts from Stack Overflow or by TheObserver
Published on 2010-03-23T04:05:00Z Indexed on 2010/03/23 4:11 UTC
Read the original article Hit count: 348

Filed under:

I'm running SQL Server 2005 Express. And I'm trying to do a bulk insert/import of a data file with a field/row terminator that uses a hexadecimal value 0x001. How should I represent it in a bulk insert command?

I have something like:

bulk insert xxx.dbo.[yyy]
from 'D:\zzz\zzz.dat'
with (
         CODEPAGE='RAW',
         FIELDTERMINATOR = '=|=',
         ROWTERMINATOR = '=|=\001\n',
         KEEPNULLS
); 

which results in

Msg 4863, Level 16, State 1, Line 7
Bulk load data conversion error (truncation) for row 1, column 3 (code).

© Stack Overflow or respective owner

Related posts about sql-server-2005