Jo¨ko ¦ugar (josko_bla@netgen_rem0ve_this_and_bla.hr) writes:
Which lock type or isolation level should I use to be sure that no one
will read or write or do anything with the table I'm using?
Code block should look something like this:
lock table
read value from table
change value to new_value
update table set value = new_value
release lock
While I'm changing the value absolutly no one should be able to read
from the table.
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.
--
Erland Sommarskog, SQL Server MVP,
es****@sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp