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
 General SQL Server Forums
 New to SQL Server Programming
 Lock record for processing

Author  Topic 

avtuvy
Starting Member

9 Posts

Posted - 2008-05-27 : 20:45:13
I run a query "BEGIN select * from NT_ins_params_S WITH (HOLDLOCK,ROWLOCK) where...... and load the result into an ADO object. I need to lock the row untill I am done processing and I thought that (HOLDLOCK,ROWLOCK) will do the job but it does not. What is the correct way for locking?

I am using sql 2000 server and interfacing with it using a program written in C#

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2008-05-28 : 02:29:51
Holdlock will hold the lock until the end of the transaction. If you're not stating begin transaction...commit, the transaction just lasts for the duration of the select statement.

That said, starting a transaction, then going to do some front end processing for an undesclosed period of time is likely to cause lengthy locks, possible blocking and general decreased transaction throughput of the system

--
Gail Shaw
Go to Top of Page
   

- Advertisement -