Solved

howto limit update to one record

Posted on 2003-11-19
1
4,744 Views
Last Modified: 2012-06-27
hi

my question is how to limit update to one row at a time when i have no creteria

my problem is like that i have a table called workq
on this table one ore more work station can read data from

but  if one workstation reads the data the outher one must not read the same data
i dont want to use locking becouse that slow the database so what i was thinking was first update a status on the row
and then read it

so it will look something like that:

NOW UPDATE ONLY ONE ROW
Update workq set status = 1
SELECT message  TOP 1 from workq where id = @@IDENTITY



thanks ronen
0
Comment
Question by:ronenhm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 15

Accepted Solution

by:
namasi_navaretnam earned 125 total points
ID: 9784361
SET ROWCOUNT 1

Update workq set status = 1

Or
Update workq set status = 1
Where ID = (Select Top 1 ID from workq)

HTH
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how the fundamental information of how to create a table.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question