robrodp
asked on
ms sql 2005 how can I lock a record for no access and then release it?
I have records that are accssed and I want to lock them in a manner that if other users want to access them they have to wait until they are unlocked....
I access my ms sqldatabse from asp scripts
I access my ms sqldatabse from asp scripts
ASKER
Its really too theoretical for me.
I need some actual code that when some one has access to a record like:
select * from table where id=1 (somehow lock the record)
something happens (that does not take too long)
somehow the record is unlocked so
If somebody sends the same query (select * from table where id=1)
but sql waits until the record is unlocked by the first user
If more queries are made ((select * from table where id=1) they are
honored as the records are unlocked
I need some actual code that when some one has access to a record like:
select * from table where id=1 (somehow lock the record)
something happens (that does not take too long)
somehow the record is unlocked so
If somebody sends the same query (select * from table where id=1)
but sql waits until the record is unlocked by the first user
If more queries are made ((select * from table where id=1) they are
honored as the records are unlocked
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You might also reply with more details if the link below does not answer your question. We can then provide a more detailed answer to your question. I am not an ms sql specific expert, but your question applies to locking in general. All database engines provide transaction ability, which is what you will need to accomplish what you are trying to do.
http://msdn.microsoft.com/en-us/library/ms175127.aspx