|
Posted by Jo¨ko ¦ugar on 07/12/05 12:17
Erland Sommarskog wrote:
>
> Razvan has already answered how you could do it. Now, next question is:
> do you really want to do this? I have no idea what sort of application
> you are working with, but generally you want as much concurrency in a
> database system. Why lock the whole table, if you are changing only
> one row? Not that I know if you are only changing one row, but I would
> like you to think twice.
>
>
You are right. It's about only one row. Is it possible to do something like:
lock row in table
read value from table
change value to new_value
update table set value = new_value
release lock
Or... can I do it in one statement?
This is wrong, but I hope you understand what I'm trying to do:
update table set value = (select @n = value from table) + 1
I need to read the value, then save it in variable and then increment it
and update.
Navigation:
[Reply to this message]
|