Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 1st, 2010, 10:56 AM
Authorized User
 
Join Date: Jun 2003
Posts: 54
Thanks: 2
Thanked 0 Times in 0 Posts
Default Copying NTEXT data from one record to another

I tried seaching the archive without much success, so here is my situation.
I have a SS2K databasewith a table that has a prime key and one NTEXT field. I need to copy data from the NTEXT field in one record to the same field in another record (and overwrite the data).

I tried using:

Code:
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!
__________________
--- Tom
 
Old September 1st, 2010, 02:16 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

See example C near the bottom of this page:
http://msdn.microsoft.com/en-us/library/ms177523.aspx

I *THINK* you need to do:
Code:
UPDATE MyTable SET MyNtext = mt2.MyNext
FROM MyTable AS mt1, MyTable AS mt2
WHERE mt1.PK = 66 AND mt2.PK = 44
Give it a try, anyway.
The Following User Says Thank You to Old Pedant For This Useful Post:
tcarnahan (September 3rd, 2010)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Mapping columns and then copying data Roshanjoshi2001 Excel VBA 0 December 10th, 2007 11:37 AM
Copying part of a record FierceDeity Access 2 April 3rd, 2007 05:45 PM
Copying data across files sda443 Excel VBA 2 January 16th, 2006 06:49 AM
Can't pull data from ntext field into recordset. rstelma SQL Server 2000 2 August 26th, 2003 04:50 PM
Can't pull data from ntext field into recordset. rstelma Classic ASP Databases 1 August 26th, 2003 03:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.