Avatar of narfk1
narfk1
 asked on

How Insert a Picture Into SQL Server 2000?

How do I insert a Image file into a field, of image type? There is no insert button as in Access ???
Microsoft SQL Server

Avatar of undefined
Last Comment
Computer101

8/22/2022 - Mon
Guy Hengel [angelIII / a3]

Access is both a (small) database + a GUI development application.
SQL Server is ONLY a (full-blown) database product, and doesn't have a true user GUI, EM and QA are only Developer & Admin tools.
If you want to insert pictures into a image column, you either need to develop an application that can do this via code, or eventually play around with the TextCopy.exe, which can read a file into a IMAGE or TEXT column.

CHeers
lschweer

Hi narfk1,

angel is right. You can't insert images directly into the SQL Server using the Enterprisemanager.

But you still can use ADO to insert the File. Use the AppendChunk and GetChunk methods of a field. Do the following steps

1.) open recordset
2.) open file and copy to membuffer (you can do that from the file directly as well)
3.) call the append chunk methods for the image field until your file is insterted
4.) Update the record

Your file is now inserted in SQL Server

Check out MSDN Documentation for further information. There is also an example inserting images. Look at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rdo98/html/rdproappendchunkx.asp


Lars
adathelad

It's recommended that you should not store an image directly in SQL Server. Although this can be done (e.g. using IMAGE datatype), it's best to only store the path to the image file in the database. Then, when your front-end application queries the database, it retrieves the file path of the image, and then goes there to open it for display.

I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
narfk1

ASKER
Angelll I tried using the textcopy.exe program to insert a picture into the database, but it doesn't seem to work. Sorry but Im new to database, but maybe im not inputting the right commands. What would I input when the program asks me to Type the Where clause: ? I only have three column in the Table called PICTURE. 1) ID 2)Person 3)Pict
so would i put the select * FROM PICTURE WHERE ID = '1' or something of that nature??
CleanupPing

narfk1:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
monosodiumg

No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
    PAQ with points refunded

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

monosodiumg
EE Cleanup Volunteer
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Computer101

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.