If you need to update a limited number of rows on a sql table using a "top"  like condition, here is a solution:
SET ROWCOUNT 100
-- update  
SET ROWCOUNT 100
update table1 set column1 =  getdate()
-- only 100 rows will be updated
 --  delete
SET ROWCOUNT 10
delete from table1 
-- only 10 rows will be deleted
No comments:
Post a Comment