473,394 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Selecting a TEXT field via SQL

I'm trying to copy a TEXT field from one table to another:

UPDATE dbo.WeSiteMenus
SET pageContent =
(SELECT pageContent
FROM WeSiteMenusArchive
WHERE archiveID = 1208)
WHERE (pageID = 1255)

However, I keep getting a

'The text, ntext, and image data types are invalid in this subquery or
aggreagate expression'

My understanding is that this is because I'm trying to SELECT a TEXT as a
nested query. I'm not sure what the workaround for this would be, though. Do
I need to write a function that get's the TEXT field by a lone SELECT
statement, then send it back with a separate UPDATE statement?

-Darrel
May 30 '06 #1
2 1119
darrel wrote:
I'm trying to copy a TEXT field from one table to another:

UPDATE dbo.WeSiteMenus
SET pageContent =
(SELECT pageContent
FROM WeSiteMenusArchive
WHERE archiveID = 1208)
WHERE (pageID = 1255)

However, I keep getting a

'The text, ntext, and image data types are invalid in this subquery or
aggreagate expression'

My understanding is that this is because I'm trying to SELECT a TEXT as a
nested query. I'm not sure what the workaround for this would be, though. Do
I need to write a function that get's the TEXT field by a lone SELECT
statement, then send it back with a separate UPDATE statement?

-Darrel

Try asking in an SQL newsgroup. You'll get better answers there. ;)
May 30 '06 #2
this is supported in sql2005, not sure what version you are running. try
using join instead:

UPDATE dbo.WeSiteMenus
SET pageContent = a.pageContent
from dbo.WeSiteMenus m
join WeSiteMenusArchive a on archiveID = 1208
WHERE m.pageID = 1255

-- bruce (sqlwork.com)
"darrel" <no*****@nowhere.com> wrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
I'm trying to copy a TEXT field from one table to another:

UPDATE dbo.WeSiteMenus
SET pageContent =
(SELECT pageContent
FROM WeSiteMenusArchive
WHERE archiveID = 1208)
WHERE (pageID = 1255)

However, I keep getting a

'The text, ntext, and image data types are invalid in this subquery or
aggreagate expression'

My understanding is that this is because I'm trying to SELECT a TEXT as a
nested query. I'm not sure what the workaround for this would be, though.
Do I need to write a function that get's the TEXT field by a lone SELECT
statement, then send it back with a separate UPDATE statement?

-Darrel

May 30 '06 #3

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

Similar topics

2
by: John | last post by:
Hello, I have a table called BUILDREQUESTS which I want to select from, depending on the project ID of each record. The Project ID field is indexed. (A) This query runs almost instantly: ...
1
by: newcomer | last post by:
I have a javascript index that is similar to the one in the Windows help. It has a text field that allows the you to type text and it finds the closest item in the list below the text field. The...
3
by: klawiter | last post by:
Greetings, I have a table with two columns. On my form, I have a combo field that displays the contents of the first column. Upon selecting an item in this combo field, I would like to then...
1
by: tshad | last post by:
Is there a way to go into the edit mode by just clicking on a field in the row of the DataGrid you want to edit? I would like to "not" show the Edit button when I show the grid. I would like to...
5
by: marfi95 | last post by:
I'm very confused. I'm trying to automatically select the text when my textbox gets the focus. This is typically when the user has clicked the mouse in the field. This is the code I have in...
4
by: Paul J. Lucas | last post by:
I have a simple form that contains an INPUT element that has an initial value. <form name="Form"> <input name="Number" type="text" value="Hello"> </form> When the form loads, I want all of...
4
by: darrel | last post by:
I have a DDL list along these lines: item value="1" text="a" item value="2" text="b" item value="3" text="c" item value="2" text="d" item value="2" text="e" item value="1" text="f" item...
3
paulrajj
by: paulrajj | last post by:
hi to all, How to Enable a text field only on selecting a radio button using only getElementById..
1
by: bytenut | last post by:
I would like to display two field values in a combo after selecting from the list items... i.e. my drop-down shows two fields from a lookup, but when I select the item, only the first field value is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.