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 > How Do You Run an Update Statement in DB2?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-02-09, 16:43
rockdave35 rockdave35 is offline
Registered User
 
Join Date: Jan 2009
Posts: 43
How Do You Run an Update Statement in DB2?

I've only done this in SQL, and not even show my code is right for SQL. I'm trying to wipe out value in a field so it is empty. I wrote this:

Code:

BEGIN TRANSACTION
update DSNP.PR01_T_USER_TRAN
set user_q_cd = NUll
where user_id_cd = 3881
and user_tran_cd = 'PR41'
ROLLBACK TRANSACTION
Does this look right? It fails with an error

An EXECUTE IMMEDIATE statement contains a SELECT or VALUES statement.

Thanks.
Reply With Quote
  #2 (permalink)  
Old 09-03-09, 03:13
aflorin27 aflorin27 is offline
Registered User
 
Join Date: Apr 2008
Location: Iasi, Romania
Posts: 317
Your code looks like MS SQL Server, because:
BEGIN TRANSACTION does not exist in DB2 (as DB2 automatically starts a transaction when it has to)
ROLLBACK TRANSACTION is not a valid DB2 statement - DB2 has ROLLBACK
__________________
Florin Aparaschivei
Iasi, Romania
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