September 25, 2007 at 8:49 am
Hi there,
How to use an INSERT statement to insert an image file in an IMAGE data type column?
Thanks,
AC
September 25, 2007 at 8:53 am
It's the same as any other insert. You need to text (binary representation) of the image.
If you have a VB.NET/C# client, you're stream in the image data to the parameter and then pass it in. Nothing special about it.
September 25, 2007 at 9:02 am
ArthurC (9/25/2007)
Hi there,How to use an INSERT statement to insert an image file in an IMAGE data type column?
Thanks,
AC
If you want to use SQL, have a look at the thread:
http://www.sqlservercentral.com/Forums/Topic378279-338-1.aspx
Regards,
Andras
ps: sorry, the first time my < witht he url was eaten by the new forum software.
September 25, 2007 at 10:02 am
I checked in the MSDN web site again but still don't have a clue. I believe I must use TEXTPTR function somehow! It would be helpful if anyone of you provide an example of the INSERT statement. I want to use INSERT statement to insert records with image for an IMAGE data type column in a table.
Many thanks,
AC
September 25, 2007 at 10:17 am
September 25, 2007 at 10:47 am
Thanks for the thread. May be my message was not clear enough. I am looking for a pure database SQL INSERT statement to insert records with image file such as jpg, bmp etc. Any idea!?
Thanks,
AC
September 25, 2007 at 12:16 pm
this will work for any binary file it was here on SCC from 07*02/2007 post if you want to google the whole thread.
INSERT INTO myTable(Document) SELECT * FROM OPENROWSET(BULK N'C:\Image1.jpg', SINGLE_BLOB) AS Document
Lowell
September 25, 2007 at 2:18 pm
Thanks for your solution Lowell.
September 26, 2007 at 2:38 am
How do you then save a VarBinary(MAX) image as a valid graphic file?
Best wishes,
Phil Factor
September 26, 2007 at 5:48 am
to insert image form application go through the following steps
1. create a stream to read file
2. convert all the data in binary format
3. create parameters to pass to image and (other value)
4. execute the sql insert command / procedure
Note:- Parameter should be image type when you pass byte info
Viewing 10 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy