|
|
Question : ERROR: the text, netext, and image data types are invalid in this subquery or aggregate expression
|
|
I have a pretty simple update query as follows but I am getting the error that "The text, ntext, and image data types are invalid in this subquery or aggregate expression". I have tried casting as nvarchar to now avail. The data types of the source and target column are all ntext. I have searched the internet high and low for a solution and have determined that this is an uncommon error but surely someone has encountered it before. I suspect that it has to do with the way ntext, text are stored and that i need to do something special. Just dunno. Any thoughts?
UPDATE Emails SET TextContent = (SELECT textcontent FROM emailtemplates WHERE emaillistid = 0), HTMLContent = (SELECT htmlcontent FROM emailtemplates WHERE emaillistid = 0) WHERE (EmailID = 1387)
|
Answer : ERROR: the text, netext, and image data types are invalid in this subquery or aggregate expression
|
|
You'll have to use the UPDATETEXT statement
You'll find working exemples in BOL
Yet you could give a try to the following if and only if there is - only one record in Emails with id 1387 - only one record in EmailTemplates with id 0
UPDATE a SET TextContent = b.textcontent, HTMLContent = b.htmlcontent from Emails a CROSS JOIN emailtemplates b WHERE a.EmailID = 1387 and b.emaillistid = 0
HTH
Hilaire
|
|
|
|
|