Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Selecting a TEXT field via SQL

Reply
Thread Tools

Selecting a TEXT field via SQL

 
 
darrel
Guest
Posts: n/a
 
      05-30-2006
I'm trying to copy a TEXT field from one table to another:

UPDATE dbo.WeSiteMenus
SET pageContent =
(SELECT pageContent
FROM WeSiteMenusArchive
WHERE archiveID = 120
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


 
Reply With Quote
 
 
 
 
Ray Booysen
Guest
Posts: n/a
 
      05-30-2006
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 = 120
> 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.
 
Reply With Quote
 
 
 
 
bruce barker \(sqlwork.com\)
Guest
Posts: n/a
 
      05-30-2006
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" <(E-Mail Removed)> wrote in message
news:%23Dx28A$(E-Mail Removed)...
> I'm trying to copy a TEXT field from one table to another:
>
> UPDATE dbo.WeSiteMenus
> SET pageContent =
> (SELECT pageContent
> FROM WeSiteMenusArchive
> WHERE archiveID = 120
> 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
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript validation for a not required field, field is onlyrequired if another field has a value jr Javascript 3 07-08-2010 10:33 AM
how to show an Image field from a SQL Server table field to a aspx page J Sahoo ASP .Net 3 04-30-2009 08:30 PM
Auto-selecting all text in a field Paul J. Lucas Javascript 4 11-28-2006 05:11 AM
1.Enter space bar for field names and save the field.The field shoud not get saved and an alert should be there as"Space bars are not allowed" Sound Javascript 2 09-28-2006 02:43 PM
Storing files in a BLOB field via SQL Juergen Gerner Python 7 07-06-2004 11:23 AM



Advertisments