473,583 Members | 3,010 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is there a way to transfer ntext data from one table to another? MSSQL2000

Is there a way to transfer ntext data from one table to another?

I tried this

UPDATE [projects]

SET [description] = (SELECT [description_nte xt] FROM [table] WHERE
[id]=1)

WHERE [id_project] = 1;
and this

DECLARE @DESCRIPTION ntext

SET @DESCRIPTION = (SELECT [bids].[bid_conditions] FROM [bids],
[projects] WHERE [bid_accepted_id] = [bids].[id_bid] AND [id_project] =
@ID_PROJECT);

UPDATE [projects]

SET [description] = @DESCRIPTION

WHERE [id_project] = 1;

none of those work in MSSQL2K,
error reported is "The text, ntext, and image data types are invalid
for local variables."

Aug 29 '06 #1
2 2746
Igor (je*******@gmai l.com) writes:
Is there a way to transfer ntext data from one table to another?

I tried this

UPDATE [projects]

SET [description] = (SELECT [description_nte xt] FROM [table] WHERE
[id]=1)

WHERE [id_project] = 1;
...
It appears that you have to use the JOIN syntax, as in this example:

CREATE TABLE #projects (id int NOT NULL,
description ntext NULL)
go
CREATE TABLE #t (id int NOT NULL,
descr ntext NOT NULL)
go
INSERT #projects (id) VALUES(21)
INSERT #t(id, descr) VALUES (1, replicate('ABCD ', 1000))
go
UPDATE #projects
SET description = t.descr
FROM #projects p
CROSS JOIN #t t
WHERE t.id = 1
AND p.id = 21
go
SELECT * FROM #projects
go
DROP TABLE #projects, #t

Note that if you are on SQL 2005, there is no reason to struggle with
ntext. Use nvarchar(MAX) instead, which is a first-class cititez, but
can fit just as much data as ntext.

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Aug 29 '06 #2
OK thank you, I will try your solution. Unfortunately i'm limited to
MSSQL 2000 but thank you for you suggestion.

Erland Sommarskog wrote:
>
It appears that you have to use the JOIN syntax, as in this example:

CREATE TABLE #projects (id int NOT NULL,
description ntext NULL)
go
CREATE TABLE #t (id int NOT NULL,
descr ntext NOT NULL)
go
INSERT #projects (id) VALUES(21)
INSERT #t(id, descr) VALUES (1, replicate('ABCD ', 1000))
go
UPDATE #projects
SET description = t.descr
FROM #projects p
CROSS JOIN #t t
WHERE t.id = 1
AND p.id = 21
go
SELECT * FROM #projects
go
DROP TABLE #projects, #t

Note that if you are on SQL 2005, there is no reason to struggle with
ntext. Use nvarchar(MAX) instead, which is a first-class cititez, but
can fit just as much data as ntext.

--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Aug 30 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2626
by: Anand | last post by:
If I insert 8000 byte of data, in the one of the column. now I want to read the data, is there any to see all the data, through select statement?
5
18516
by: Cally | last post by:
Hello, I would like to convert a field from ntext field found in one database table to float field found in another database table. The reason why I want to do this is a long one. I have tried the following and playing around with the following: declare @valuePointer varbinary(16)
1
6295
by: Derek Erb | last post by:
SQL Server 2000 : I have a series of tables which all have the same structure. When any of these tables are modified I need to syncrhonise all of those modifications with one other table wich is a sort of merge of the individual tables with one extra column. For most of these tables this is not a problem. The problem arrives when one of...
2
8747
by: Sileesh | last post by:
HI I know this is not the right forum to post this question, but i think some one might have a suggestion. I have a Table "Test" with columns Id bigint (PK), Number Varchar(50), Notes ntext. in sql server 2000 I ahve a stored procedure in which i am trying to insert the same data as new record with column "Number" changed.
4
3619
by: Cylix | last post by:
Is there any difference between a nText field value='' and value=NULL ?
3
2931
by: =?Utf-8?B?ZGF2aWQ=?= | last post by:
I try to follow Steve's paper to build a database, and store a small text file into SQL Server database and retrieve it later. Only difference between my table and Steve's table is that I use NTEXT datatype for the file instead of using IMAGE datatype. I can not use SqlDataReader to read the data. I need your help, Thanks. -David (1) I...
0
1224
by: comp21 | last post by:
Hi, Now, I have retrieved or imported data from excel spreadsheet to vb6 application. Now I want to compare this part of data with the one already existing in mssql2000 server(table name being same). If some data which is there in excel spread sheet not to be found in mssql2000 server then those data has to be stored in a seperate table in...
0
831
by: sko | last post by:
I have created an access data project in acces 2003 and have SQL Server 2003 on my client computer. When I try to transfer the database to Windows SQL Server on our main server to start business wide use I am blicked by an Error indicating I cannot transfer a table with textimage_on if it has no ntext or image columns. Well...I have no tables...
6
7328
by: curly | last post by:
Hi, I have a log table where a date time is stored in an ntext field. I need to take this date time and use it to search for other records logged at that date time. I've tried using a subquery and comparing the datetime to the ntext but this obvioiusly wouldn't work. Converting the ntext to a datetime, nvarchar or varchar isn't working...
0
8327
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7935
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8193
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6579
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5701
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5374
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3818
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3843
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2333
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.