If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > DB2 Update Statment

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-11-05, 10:28
JDionne JDionne is offline
Registered User
 
Join Date: Aug 2002
Location: Charlotte NC
Posts: 663
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
Reply With Quote
  #2 (permalink)  
Old 01-11-05, 10:32
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
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);
Reply With Quote
  #3 (permalink)  
Old 01-11-05, 10:35
JDionne JDionne is offline
Registered User
 
Join Date: Aug 2002
Location: Charlotte NC
Posts: 663
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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