Bulk Insert Binary Problem

decrypt

Well-known member
Joined
Oct 6, 2003
Messages
216
Im getting an error while trying to load some data that includes a binary field into a database. Doing a INSERT INTO works fine, but doing a BULK LOAD doesnt. How could I fix this problem? Do I have to specify any additional information in the BULK INSERT command?

Command:
BULK INSERT Table_2 FROM c:\temp.txt WITH (FIELDTERMINATOR = ,, ROWTERMINATOR = :)

File Contents: (temp.txt)
DEFAULT,0x1000
The binary field is the final field (col 2)

Error Message:
Bulk load data conversion error (type mismatch or invalid character for the specified codepage) for row 1, column 2 (data). The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error. Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".

Thanks for the help.

Edit: btw, im using SQL Server 2005 Express
 
Last edited by a moderator:
Well after trying to figure it out again for a couple of hours I finally figured it out. With BULK INSERT you completely leave off the 0x. Hopefully this helps somebody else out in the future who did not realize this either. Also make sure its an even number of characters. I tried it multiple amounts of times without the 0x, but I guess I had an uneven amount of characters.

*PROBLEM SOLVED*
 
Back
Top