Update a table value with out using update command
Is it possible to update a table value with out using update command? if yes what is the reason, if no what is the reason?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Pravin MorePosted Nov 16, 2011, 12:00 AM
Thanks,
Pravin
AartiPosted Nov 15, 2011, 7:27 AM
Update a table value with out using update command
then i suggest by using Replace we can update value of table. :)
Arjun PanwarPosted Nov 15, 2011, 7:11 AM
Thanks for giving the best answer.
Pravin MorePosted Nov 15, 2011, 6:40 AM
but arjun my point was when we look for something other that update statement?? is when we dont have permision to update....so when someone dont have permision for "Update" he even dont have it for "replace into" too.....
Thanks,
Pravin.
Arjun PanwarPosted Nov 15, 2011, 5:00 AM
Mr Pravin
do you agree with Deepika reply ?
AartiPosted Nov 15, 2011, 2:36 AM
use Replace command
replace into tablename(primary key,....{rest of the columns in the table}) values(the same primary key, new values );
this will delete the previous row and insert a new row with the same primary key and updated column values.
I hope it will help you..
Thanks.
Pravin MorePosted Nov 15, 2011, 1:59 AM
its not possible without update command n the reason is........ if yes then some user dont have pevilage to update even he can update......it will voilate access rights.
if you have insert delete permision then can do 1 thing delete n reinsert that row with new record....but this is worst solution as if someone dont have update rights then he dont have insert,delete rights too....
Thanks,i hope i am specific to you quetion.
Pravin.
dev 0Posted Nov 15, 2011, 1:57 AM
Use merge command. If the rows already exist then it will
update it with new data if not it would insert the new data
Hope this will help you.
Thanks