Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

I'm 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 doesn't. 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, i'm using SQL Server 2005 Express

Edited by decrypt
Posted

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 it's 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*

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...