473,385 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

SQL server lock issue

I have an application that runs on many workstations that all pull the next record from a sql table. I use a stored procedure to located the next record and give it to the agent. I use a transaaction and locks, and the record is checked out at the time it is selected so that no other agent can get the record but from time to time 2 agents get the same record, as if the locking does not work.


Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. SET TRANSACTION ISOLATION LEVEL READ COMMITTED
  4.  
  5. insert #nextlead 
  6.         select  l.[project ID] ,recordid,l.[lead id] ,call_type,@startpage as startpage,phone 
  7.         from Preview_Call_Leads l with (rowlock)
  8.          inner join Preview_Call_Queue q with (rowlock) on q.[lead ID] = l.[lead id]
  9.          where l.[project id] = @projectID
  10.         and call_type  <> 1 and call_type  <> 5
  11.         and [checked out] = 0 and subcode = 0
  12.             and [Next Call Time]< = getdate() 
  13.     and datepart(hh,dateadd(hh,(8-TimeZoneOffset),getdate()))< 18
  14.     and datepart(hh,dateadd(hh,(8-TimeZoneOffset),getdate()))>= 8
  15.         order by call_type 
  16.  
  17.  
  18. update preview_call_queue WITH(ROWLOCK) set [checked out] = 1 where [lead id]= @leadid
  19.  
  20.  
Jan 15 '07 #1
1 1848
iburyak
1,017 Expert 512MB
I think you have shared lock in your first statement no mater what your hint is.

Use
BEGIN TRAN
COMMIT TRAN
instead.
Jan 16 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

19
by: Thue Tuxen Sørensen | last post by:
Hi everybody ! I´m maintaining a large intranet (approx 10000 concurrent users) running on one IIS box and one DB box with sqlserver 2000. Currently there is 2,5 GB Ram, 1 1400 mhz cpu and 2...
0
by: Eddie Borden | last post by:
I have a MS-SQL server in a V-LAN that has other MS-SQL servers in it and is connected to other V-LAN's that have MS-SQL servers. I am trying to lock down this server in everyway possible. I...
2
by: Roy Padgett | last post by:
I have a combo box where users select the customer name and can either go to the customer's info or open a list of the customer's orders. The RowSource for the combo box was a simple pass-through...
15
by: Michael Rybak | last post by:
hi, everyone. I'm writing a 2-players game that should support network mode. I'm now testing it on 1 PC since I don't have 2. I directly use sockets, and both client and server do...
4
by: Prince Kumar | last post by:
I joined a company recently and they have a java program which hangs (does nothing) after a while. This is no way consistent. It could succeed quite a few times and can fail a few other times....
2
by: Trent | last post by:
Hello, all. I have the following production DB2 environment. DB2 8.1.4 (fp4) WG edition with 2 production databases on Windows 2003 standard edition. My first question is regard with...
94
by: Samuel R. Neff | last post by:
When is it appropriate to use "volatile" keyword? The docs simply state: " The volatile modifier is usually used for a field that is accessed by multiple threads without using the lock...
7
by: David | last post by:
i think i just realized i'm an idiot. again. (not syntactically correct code... just pieces to illustrate) class StateObject { members like socket, receiveBuffer, receiveBufferSize,...
11
by: fritzcwdev | last post by:
I have a class as follows: public class OperationFeedback { DateTime _startTime; public DateTime StartTime { get {
6
by: Curious | last post by:
I have an arraylist used in three separate methods. In method #1 (event method), some items are removed from the arraylist if certain conditions are met; In method #2 (event method),...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.