02-18-2009 10:47 AM
Hi experts,
I have a problem with update command. It updates all the rows in my database. Id is a key field, but it updates all the rows, not only that rows where id = k_id
UPDATE z_mytab SET: mod = k_mod,
ftip = k_ftip,
name = k_name
WHERE id EQ k_id.
Edited by: mrwhite on Feb 18, 2009 11:49 AM
02-18-2009 10:50 AM
hi ,
According to your query all id will be modified which have the id specified in k_id.
Regards
Pinaki
02-18-2009 10:50 AM
Hi,
Refer to the following link to know more about Syntex of update command.
http://help.sap.com/saphelp_nw04s/helpdata/en/eb/805a4201301453e10000000a155106/frameset.htm
Regards
Rajesh Kumar
02-18-2009 10:50 AM
Hi.... It won't update where ever that WHEE criteria is matched. To update u need to use key fields in WHERE condition.
Regards,
KP.
02-18-2009 10:51 AM
in the where conditions give key fields also so that it will update the particular row
which satisfy the key fields.
02-18-2009 10:52 AM
Hi ,
I suppose you must go with the modify command with the syntax
Modify z_mytab transporting a b c.
Try if this helps.
Sumit.
02-18-2009 10:53 AM
02-18-2009 10:53 AM
Hello
SAP wrote:
If there is no WHERE clause, all lines (in the current client) are updated. If a WHERE condition is specified, only those records which satisfy the WHERE condition are updated.
02-18-2009 10:58 AM
I have the where clause, but something should be wrong with my update statement, because it updates all the rows in my table. I have only 1 keyfield 'ID' and I'm using it. So that's why I don't understand why is it wrong.
02-18-2009 10:55 AM
Hi,
You have written the query like that.
Is It should not been updated?
02-18-2009 11:01 AM
Hi,
you have to use in loop or you have to put the data which you want keep in database table using following stmt
UPDATE dbtab FROM TABLE itab
Thanks
Parvathi
02-18-2009 11:02 AM
Okay I've got the problem:
UPDATE z_mytab SET: mod = k_mod,
ftip = k_ftip,
name = k_name
WHERE id EQ k_id.
it should be without ':' like this:
UPDATE z_mytab SET mod = k_mod,
ftip = k_ftip,
name = k_name
WHERE id EQ k_id.
02-18-2009 11:30 AM