Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4783
  • Last Modified:

howto limit update to one record

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
ronenhm
Asked:
ronenhm
1 Solution
 
namasi_navaretnamCommented:
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now