November 29, 2008 at 6:21 am
Hi,
Please provide me the query to insert image at specific row i.e.
INSERT INTO Tablename -> Cloumnname -> where id ="xx"
November 29, 2008 at 10:08 am
fwiw you insert an image column just like any other column.
insert into yourtable (yourimagecolumnname) values (@thevariable)
BOL will help you !
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
November 29, 2008 at 10:40 am
Can you script out the table definition and show it to us?
Thanks,
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
November 29, 2008 at 11:53 pm
Below is the query which i know to insert an image but i dont know how can i modify this query and insert at specific row.i.e. with WHERE clause.
In my table i have imgID,imgType,imgData,imgTitle,imgLength as column name.
INSERT INTO tblImage(imgData)
SELECT * FROM
OPENROWSET(BULK N'F:\MUKESH PERS\Images\200810A0\Image026.jpg', SINGLE_BLOB)
AS imgData
GO
December 1, 2008 at 9:04 am
makjain (11/29/2008)
Below is the query which i know to insert an image but i dont know how can i modify this query and insert at specific row.i.e. with WHERE clause.In my table i have imgID,imgType,imgData,imgTitle,imgLength as column name.
INSERT INTO tblImage(imgData)
SELECT * FROM
OPENROWSET(BULK N'F:\MUKESH PERS\Images\200810A0\Image026.jpg', SINGLE_BLOB)
AS imgData
GO
Did you mean to actually UPDATE a row where ImgID = x? If NOT, and you have to insert imgID manually, then couldn't you do something like:
INSERT INTO tblImage(imgID, imgData)
SELECT 5 AS imgID, imgData.*
FROM OPENROWSET(BULK N'F:\MUKESH PERS\Images\200810A0\Image026.jpg', SINGLE_BLOB) AS imgData
December 1, 2008 at 9:28 am
Yes, i want to update a row with image data where imgid = X.
Please reply m waiting eagerly
December 1, 2008 at 10:34 am
Try something like this (untested):
UPDATE tblImage
SET imgData = (SELECT BulkColumn FROM
OPENROWSET(BULK N'F:\MUKESH PERS\Images\200810A0\Image026.jpg', SINGLE_BLOB))
WHERE (imgID = 5)
Of course, replace the imgID = 5 with the correct ID.
December 2, 2008 at 8:53 am
Hi Friend,
I m getting below underlined error message when i tried to update the table.
A correlation name must be specified for the bulk rowset in the from clause.
December 2, 2008 at 9:36 am
makjain (12/2/2008)
Hi Friend,I m getting below underlined error message when i tried to update the table.
A correlation name must be specified for the bulk rowset in the from clause.
Try this one then:
UPDATE tblImage
SET imgData = (SELECT BulkColumn FROM
OPENROWSET(BULK 'F:\MUKESH PERS\Images\200810A0\Image026.jpg', SINGLE_BLOB) AS i)
WHERE (imgID = X)
Note the "AS i" portion.
December 2, 2008 at 9:58 am
OK gr8.....now its working
Lots of blessing and thanx.....Finally
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply