Solved

howto limit update to one record

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now