Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 1st, 2010, 10:56 AM
Authorized User
Points: 306, Level: 6
Points: 306, Level: 6 Points: 306, Level: 6 Points: 306, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , .
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
Reply With Quote
  #2 (permalink)  
Old September 1st, 2010, 02:16 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
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.
Reply With Quote
The Following User Says Thank You to Old Pedant For This Useful Post:
tcarnahan (September 3rd, 2010)
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 05:25 AM.


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