If you want to simulate a record lock in SQL Server you can try this technique described by Sergey Berezniker at another forum:
Code:
-- Will hold a lock on a record until COMMIT is issued. Exec 1 line at a time in SMSS
BEGIN TRANSACTION
SELECT SomeColumn FROM dbo.MyTable WITH (TABLOCKX) WHERE SomeCriteria
(Now run application code against locked record)
COMMIT -- Releases lock
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.