Lock on SQL rows


Can some one please help how can I acquire lock on rows while it is being worked by some one.

My requirement is if a record is being used by some one then it should not be available for other users to edit. But other users can able to see but cannot edit the rows.


You can use application locks with the stored procedures sp_getapplock and sp_releaseapplock..