Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Row level locking

Author  Topic 

royv
Constraint Violating Yak Guru

455 Posts

Posted - 2002-08-01 : 10:50:18
I would like to implement a row level lock that maintains the lock until I say to release the lock. We are doing some testing to check a couple of things. It can be a SELECT,UPDATE or INSERT statement. We are on SQL Server 7 SP3. To reiterate, I want to control the amount of time that a row level lock is held.

*************************
Someone done told you wrong!

JustinBigelow
SQL Gigolo

1157 Posts

Posted - 2002-08-01 : 11:02:46
If you want to set a certain time limit you can use WAITFOR (see BOL). If you mean that you want to lock a row when a user selects it (through a button on your front end for instance) then my suggestion would be to add a bit column to the table for a status to indicate either Locked or Unlocked. Other user's searches should then filter out rows with a locked status. As far as I know you cannot have lock hint respond to events.

Justin

Go to Top of Page

royv
Constraint Violating Yak Guru

455 Posts

Posted - 2002-08-01 : 11:05:40
I knew I should have trusted BOL! Ya I found it, basically implement a locking hint within a transaction and don't commit or rollback and then use the WAITFOR statement. Thanks.

*************************
Someone done told you wrong!
Go to Top of Page
   

- Advertisement -