with - update top 1 record in sql server




SQL Server how to update only one row in database? (2)

You can just add LIMIT 1 at the end of the query.

How to I can update only one record on db?

Table:

name       name1       name2
----------------------------
xx         xy          xz
xx         xx          xx
xx         xx          xx
xx         xx          xx
xy         xx          zz

Update query:

UPDATE table1 
SET name2 = '01' 
WHERE name1='xx'

but I need update only one row per time


if you want update one row per time, please try to add an Identity Column to your table to identify each row.





sql-update