Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 update one record only movefirst SQL 2000 server

Author  Topic 

avtuvy
Starting Member

9 Posts

Posted - 2007-11-26 : 17:44:22
I have a case where there are multiple records with identical data in the database, (identical including insertion time). I need to update those records one by one by doing a query selecting the first record updating one field and so on. When I query the database and update it updates all of the records that came up inthe query, how do I select only one record?

Select * from MyDevices where processed='0'
here I need to somehow select one record
Update MyDevices set processed="1"
Select * from MyDevices

Please help

austdev
Starting Member

3 Posts

Posted - 2007-11-26 : 18:15:06
if you use the command

Set RowCount 1

Before the update, it will only affect 1 row.

Be sure to use :

Set RowCount 0

when you are done to return to updating all rows.

Go to Top of Page
   

- Advertisement -