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
 Transact-SQL (2000)
 Finding Locked rows

Author  Topic 

Sprinjee
Starting Member

42 Posts

Posted - 2007-03-27 : 06:42:31
I want to update rows in a particular table however I only want to perform the update if someone is not working on this data (e.g. when rows are locked)

I'm able to see whether someone is locking data inside aparticular table. Is it possible to deduct the specific rows in the object that are locked?

select * from master..syslockinfo SL
LEFT JOIN master..sysprocesses SP ON SP.SPId = req_spid
LEFT JOIN sysobjects so ON so.id = sl.rsc_objid

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-03-27 : 06:50:27
Check the BOL to see if the READPAST locking hint is what you want.
Other solution is to implement custom locking mechanism by introducing a flag column in the table and setting/clearing this column to indicate row being locked/unlocked.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page
   

- Advertisement -