Image field update

Pieter2008

Well-Known Member
Joined
May 14, 2008
Messages
150
How can i run a simple query to update one image field to equal another one in the same table?
MS SQL 2005
 

dequadin

Expert Member
Joined
May 9, 2008
Messages
1,434
I'm not sure what you mean by "image field", maybe a blob?

Have you tried this:
Code:
UPDATE table
SET field2 = field1
 

Pieter2008

Well-Known Member
Joined
May 14, 2008
Messages
150
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:

dequadin

Expert Member
Joined
May 9, 2008
Messages
1,434
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