Selecting a TEXT field via SQL

Discussion in 'ASP .Net' started by darrel, May 30, 2006.

  1. darrel

    darrel Guest

    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
    darrel, May 30, 2006
    #1
    1. Advertising

  2. darrel

    Ray Booysen Guest

    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. ;)
    Ray Booysen, May 30, 2006
    #2
    1. Advertising

  3. 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" <> wrote in message
    news:%23Dx28A$...
    > 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
    >
    bruce barker \(sqlwork.com\), May 30, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. J Sahoo
    Replies:
    3
    Views:
    5,260
    naikpalak
    Apr 30, 2009
  2. Juergen Gerner

    Storing files in a BLOB field via SQL

    Juergen Gerner, Jun 6, 2004, in forum: Python
    Replies:
    7
    Views:
    1,857
    Martin Bless
    Jul 6, 2004
  3. Sound
    Replies:
    2
    Views:
    430
    Randy Webb
    Sep 28, 2006
  4. Paul J. Lucas

    Auto-selecting all text in a field

    Paul J. Lucas, Nov 28, 2006, in forum: Javascript
    Replies:
    4
    Views:
    77
    Randy Webb
    Nov 28, 2006
  5. jr
    Replies:
    3
    Views:
    409
Loading...

Share This Page