Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665

    Unanswered: DB2 Update Statment

    My code as fololows
    Code:
    update DB2ADMIN.DW_WQAS_ALL_TBL
    set Multi_flag = (select 'M' 
    		from db2admin.dw_wqas_all_tbl dw , session.wqas w
    		where dw.contno = w.contno);
    I need to update a base table (db2admin.dw_wqas_all_tbl) to mark multipile instances of a container number. When I run this code I get the following error.

    Code:
    SQL0811N  The result of a scalar fullselect, SELECT INTO statement, or VALUES INTO statement is more than one row.
    This makes sence because there are mulitpile records in the base table. How do I get around this?
    ------------
    And back to SQL Server....I always find my way home
    View my Linkedin profile

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    How about this?
    Code:
    update DB2ADMIN.DW_WQAS_ALL_TBL dw
    set Multi_flag = 'M' where exists (select 1 from session.wqas w
    		where dw.contno = w.contno);

  3. #3
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665
    Quote Originally Posted by n_i
    How about this?
    Code:
    update DB2ADMIN.DW_WQAS_ALL_TBL dw
    set Multi_flag = 'M' where exists (select 1 from session.wqas w
    		where dw.contno = w.contno);
    Sweetness!!!!!! Worked like a charm.
    Thanx
    ------------
    And back to SQL Server....I always find my way home
    View my Linkedin profile

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •