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
 SQL Server Development (2000)
 Image Bulk Insert

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-02-07 : 09:23:43
Nathan writes "Is there any way one could do an image bulk insert? I do not want to store the path of the image that points to a directory on the local machine. I am looking for a query whereby I can convert the image to binary and store the actual image. Any help or direction would be grateful.

Thanking you in advance."

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-02-07 : 10:05:45
quote:
I do not want to store the path of the image that points to a directory on the local machine
You don't have to. You can store the image file ANYWHERE that is accessible via a URL or UNC path. If you wanted to store the image in the database directly, you'd have to upload it to the server's local drives anyway, especially if you want to perform some kind of bulk insert.

There are a lot of problems that come up with storing images in a database, you might want to consider:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=21839

If you check the FAQ, there is an article that describes how to put the image into the database, but it is not a bulk insert per se. You may be able to modify it to do such a thing, if you insist on importing image data to the database, but I think it's a bad idea.

Go to Top of Page

jasper_smith
SQL Server MVP & SQLTeam MVY

846 Posts

Posted - 2003-02-07 : 12:59:22
There is a tool that is on the SQL Server install CD called Bulk Image Insert. It can be found in \DEVTOOLS\SAMPLES\UTILS\UNZIP_UTILS.EXE - unzip this file and there will be a folder called bii with the tool and some demo files. This utility detects when an image field is the destination database field and the input is a file name that can be located in the file system. In this case, instead of loading the filename string into the image field, the program opens the file, loads the data, and inserts the file contents in the image data type field.Here's a link from the resource kit about using BLOB's [url]http://www.microsoft.com/technet/treeview/default.asp?url=/technet/prodtechnol/sql/reskit/sql2000/part3/c1161.asp[/url]

Syntax for BII

Bii dbtable in filename /SServerName /DDatabaseName /UUserName /PPassword [/TTableName] [/cCharacterData] [/FFirstRow] [/LLastRow] [/tFieldDelimiter] [/v] [/mMaxErrors]



HTH
Jasper Smith
Go to Top of Page
   

- Advertisement -