Image field update

Pieter2008

Well-Known Member
Joined
May 14, 2008
Messages
162
Reaction score
35
Location
Vrystaat
How can i run a simple query to update one image field to equal another one in the same table?
MS SQL 2005
 
I'm not sure what you mean by "image field", maybe a blob?

Have you tried this:
Code:
UPDATE table
SET field2 = field1
 
Thanks for response, but already tried that and it gives : "The text, ntext, and image data types are invalid in this subquery or aggregate expression."
Image is a data type in 2005.

EDIT :

UPDATE tblLogos SET logo = (SELECT logo FROM tblLogos WHERE LogoID = 1) WHERE LogoID = 2

Here's the query, the subquery is obviously the problem
 
Last edited:
This is a guess:

Code:
UPDATE tblLogos 
SET logo = 
    (SELECT CAST(logo AS VARCHAR(MAX))
    FROM tblLogos 
    WHERE LogoID = 1) 
WHERE LogoID = 2

You may also need to case the result of the sub query back to an image, I'm not sure never worked with the image type
 
Last edited:
Top
Sign up to the MyBroadband newsletter
X