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
 Transact-SQL (2000)
 Copying NTEXT data from one record to another

Author  Topic 

tcarnahan
Starting Member

23 Posts

Posted - 2010-09-01 : 10:29:55
I tried seaching the archive without much success, so here is my situation.

I have a SS2K database.

I have a table with one NTEXT field. The table has a prime key and I need to copy data from that field in one record to another record.

I tried using:

UPDATE MyTable
SET MyNtext = (SELECT MyNtext FROM MyTable WHERE PK = 44)
WHERE PK = 66


I get the error code:
quote:

.Net SqlClient Dataq Provider: Msg 279, Level 16, State 3, Line 40
The ntext data type is invalid in the subqquery or aggregate expression.


I started playing around with READTEXT and WRITETEXT, but I don't know how to get the output from the READTEXT to feed the input of the WRITETEXT.

Does anyone have an example of how to do this? Any help would be appreciated!




Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2010-09-01 : 11:05:55
You could try this

UPDATE mt SET
[myNtext] = mt2.[mtNText]
FROM
MyTable AS mt
JOIN MyTable AS mt2 ON mt2.[PK] = 44
WHERE
mt.[PK] = 66

Not sure if you can do this directly on NTEXT fields through.


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page
   

- Advertisement -