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)
 Updating a text data type

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-07-16 : 09:31:05
Brian writes "Hello,

I am trying to simply copy a text data type field from one table to another table, using this SQL:

UPDATE Table1
SET Essay1 =
(SELECT Essay1 FROM Table2
WHERE Table1.UserID = Table2.UserID)

Intuitively, I though this would work.
However, I receive this error message: [Microsoft][ODBC SQL Server Driver][SQL Server]The text, ntext, and image data types are invalid in this subquery or aggregate expression.

Any ideas how to update the contents of a text data type field in one table with existing data from another table?

Thanks,
Brian Philpot"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-07-16 : 10:31:57
See if this works:

UPDATE T1
SET Essay1=T2.Essay1
FROM Table1 T1
INNER JOIN Table2 T2 ON (T1.UserID=T2.UserID)


It's basically the same idea as your original statement, just not using a subquery.

If that does not work, you'll have to investigate using the READTEXT, WRITETEXT and UPDATETEXT commands, which are fully documented in Books Online, including examples.

Go to Top of Page
   

- Advertisement -