Showing posts with label lock. Show all posts
Showing posts with label lock. Show all posts

Wednesday, March 28, 2012

How do I lock a table in loop

I'm doing some testing and need to lock a table indef I need to tablock
in a loop until its canceled can't seem to work it out?
thanksred
Please look at TRANSACTION ISOLATION Level in the BOL.
"red" <cap_sch@.yahoo.co.uk> wrote in message
news:1118227150.695525.254310@.z14g2000cwz.googlegroups.com...
> I'm doing some testing and need to lock a table indef I need to tablock
> in a loop until its canceled can't seem to work it out?
> thanks
>sql

How do I lock a table in loop

I'm doing some testing and need to lock a table indef I need to tablock
in a loop until its canceled can't seem to work it out?
thanks
red
Please look at TRANSACTION ISOLATION Level in the BOL.
"red" <cap_sch@.yahoo.co.uk> wrote in message
news:1118227150.695525.254310@.z14g2000cwz.googlegr oups.com...
> I'm doing some testing and need to lock a table indef I need to tablock
> in a loop until its canceled can't seem to work it out?
> thanks
>

How do I lock a table in loop

I'm doing some testing and need to lock a table indef I need to tablock
in a loop until its canceled can't seem to work it out?
thanksred
Please look at TRANSACTION ISOLATION Level in the BOL.
"red" <cap_sch@.yahoo.co.uk> wrote in message
news:1118227150.695525.254310@.z14g2000cwz.googlegroups.com...
> I'm doing some testing and need to lock a table indef I need to tablock
> in a loop until its canceled can't seem to work it out?
> thanks
>

How do I lock a record in ms-Sql 2000 in a Stored Procedure

Let say 3 person update the same record at the same time the count field must be increment 3.

I want to search for the record on id.
Lock the record so other users can't READ the record
Read the count field of the record
ad +1 to the count
update the record with the new count
unlock the record so other user can increment the count on the same record.

Is there a beter way to do this?

All the user will run the same StoredprocedureOriginally posted by ddp2307
Let say 3 person update the same record at the same time the count field must be increment 3.

I want to search for the record on id.
Lock the record so other users can't READ the record
Read the count field of the record
ad +1 to the count
update the record with the new count
unlock the record so other user can increment the count on the same record.

Is there a beter way to do this?

All the user will run the same Storedprocedure

Also, you could use optimistic concurrency - for details see BOL.