Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • 1
    I've thought about such an approach, but what if the application crashes? Or if the server goes down. How do I unlock the record in such a situation? Commented Sep 22, 2010 at 8:09
  • There is no easy way, I think. Make the locks expire by recording a datetime that it was locked and use a trigger or scheduled job to cleanup locks that exist too long. What you're essentially doing is pessimistic locking. also see this: stackoverflow.com/questions/386162/pessimistic-lock-in-t-sql Commented Sep 22, 2010 at 8:23