Showing posts with label How to update top 100 records from table in SQL. Show all posts
Showing posts with label How to update top 100 records from table in SQL. Show all posts

Sunday, 23 September 2012

How to update top 100 rows from table in SQL


How to Update top 100 amount of data from a table in SQL

Below codes update top 100 rows. So it never meets the timeout exception and will complete execution faster than normal query
Query for update status of  top 100 data from the table My Table order by date in SQL 


WITH Q as
(
select top 100 * from My_Table order by DATE desc
)
UPDATE Q
SET Status = 0