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 2000 Forums
 Import/Export (DTS) and Replication (2000)
 BULK INSERT for 'image' data

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-12-17 : 09:05:08
Nilesh writes "I want to write an application which transfers the database from Btrieve to SQL Server. I decided to use BULK INSERT for this. y approach was copy all the data from Btrieve files to some temporary text files, with pre determined roe and column terminators, and then use BULK INSERT statement to copy the data into SQL tables.

But i am facing a problem for 'image' field. The data for image field is binary data. When i call my BULK INSERT, i get an error message as

Server: Msg 4864, Level 16, State 1, Line 1
Bulk insert data conversion error (type mismatch) for row 1, column 10 (PageThumbNail).

Is there any special handling for 'image' field that i need to do before BULK INSERT?

Thanks in advance,
Nilesh."

robvolk
Most Valuable Yak

15732 Posts

Posted - 2001-12-17 : 09:37:45
There is an undocumented bcp-like utility called textcopy.exe, it is located in one of the MSSQL folders. You can get help on how to use it by running it as:

textcopy/?

Books Online has SPARSE documentation on this, if anything it will confuse you, so use the output from the /? flag to learn how to use it.

Also, you should consider NOT storing image data in the database, by that I mean if you are truly storing JPG or GIF images. You are far better off keeping the images as files and storing a link to the file in the database. As you've encountered already, SQL Server is not too good with storing and manipulating text/image data.

Edited by - robvolk on 12/17/2001 09:40:08
Go to Top of Page

efelito
Constraint Violating Yak Guru

478 Posts

Posted - 2001-12-17 : 11:50:56
As a side note, textcopy.exe is stored in the binn directory on the CD-ROM. The file is not copied to your HD when you install SQL Server or the client tools.... it took me a little while to find it the first time. :P

Jeff Banschbach
Consultant, MCDBA
Go to Top of Page
   

- Advertisement -