Solved

howto limit update to one record

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how the fundamental information of how to create a table.

758 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

18 Experts available now in Live!

Get 1:1 Help Now