You are here: Re: Table Lock « MsSQL Server « IT news, forums, messages
Re: Table Lock

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]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация