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
 Development Tools
 ASP.NET
 Check For Locks

Author  Topic 

ann
Posting Yak Master

220 Posts

Posted - 2007-11-06 : 08:24:49
I have run into some issues on my application when querying the db (sql server 2000). It seems there is another application that runs some batch process and locks records when it does whatever it is that it does. Of course, whenever someone runs my application while these locks are on, my query results are either bizarre or simply timeout.

Is there anyway I can check to see if there are locks prior to running my query? I checked the internet and cannot find a way to do this - I was hoping there was something available via ado.net... does anyone know?

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-11-06 : 11:52:46
You cant check if there are locks but if the up-to-the-sec data is not important you can use NOLOCK in your queries so you are just reading older data...

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

ann
Posting Yak Master

220 Posts

Posted - 2007-11-06 : 13:08:24
I've already tried using the NoLock and still run into issues. I've read quite a bit recently on record locking & SQL Server and from what I gather, it can be a real pain. The other process is locking 10000 records at a time --- sigh ...

Someone sugested that the other application set a flag in a seperate table somewhere when they are running their process and I check that flag before running my queries... does that make sense?
Go to Top of Page

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-11-06 : 13:39:43
quote:
Originally posted by ann

I've already tried using the NoLock and still run into issues. I've read quite a bit recently on record locking & SQL Server and from what I gather, it can be a real pain. The other process is locking 10000 records at a time --- sigh ...

Someone sugested that the other application set a flag in a seperate table somewhere when they are running their process and I check that flag before running my queries... does that make sense?



You could try that but if you have a choice you might want to look into why that other process is locking up 10k rows? Do you know what exactly the other process does?

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

ann
Posting Yak Master

220 Posts

Posted - 2007-11-06 : 15:30:28
the db stores a bunch of PDF's - which are huge. So that the db/server can run decently they are constantly purging/replacing these friggin pdf's. There are massive amounts of pdf docs that are being stored. I've worked on another project that stored pdf's - they eventually changed their whole architecture because of the problems with the pdf's and all the probs associated with it.
Go to Top of Page
   

- Advertisement -