• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 715
  • Last Modified:

SQL Server Lock Record or Multiple Records

I want to lock a single record in a specified table of my Database.
I want to excecute this lock to this record when my application starts and unlock when the application shutdown.
1 Solution
Geert GOracle dbaCommented:
why do you want to lock a record ?
locking of records is only done when you need to modify the data in that record

lets say you lock a record and the database on some server fails over to another database
your lock would be useless ...

care to explaing what you actually want ?
You could query the single record on load and then close the query when you close the app

select *
from your_table with (rowlock)
where id = x
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now