Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 copying an image

Author  Topic 

timcyberbanjo
Starting Member

3 Posts

Posted - 2009-05-20 : 00:11:07
Hi< I am using SQL Server 2000. I am trying to "copy" an image from one record to the next. The SQL is fine for fields that contain a string, but will not work for an "image"

-- this works
UPDATE program_edition
SET
program_edition_image_width =
(SELECT program_edition_image_width
FROM program_edition
WHERE program_edition_id = 203)
WHERE program_edition_id = 202


-- this does NOT work (it is trying to copy an image)
UPDATE program_edition
SET
program_edition_image =
(SELECT program_edition_image
FROM program_edition
WHERE program_edition_id = 203)
WHERE program_edition_id = 202

The error returns

"The text, ntext, and image data types are invalid in this subquery or aggregate expression"

Could you show me the SQL I need?
Thankyou.


Tim Saunders
check out www.seagrassmusic.com

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-05-20 : 00:16:56
use INNER JOIN


UPDATE t
SET program_edition_image = s.program_edition_image
FROM program_edition t
INNER JOIN program_edition s
ON t.program_edition_id = 202
AND s.program_edition_id = 203




KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

timcyberbanjo
Starting Member

3 Posts

Posted - 2009-06-01 : 21:22:21
great! Thanks. It works a treat.

Tim Saunders
check out www.seagrassmusic.com
Go to Top of Page
   

- Advertisement -