Solved

howto limit update to one record

Posted on 2003-11-19
1
4,734 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
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how the fundamental information of how to create a table.

770 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