Sql – how can I Update top 100 records in sql server

sqlsql serversql-updatetsql

I want to update the top 100 records in SQL Server. I have a table T1 with fields F1 and F2. T1 has 200 records. I want to update the F1 field in the top 100 records. How can I update based on TOP 100 in SQL Server?

Best Answer

Note, the parentheses are required for UPDATE statements:

update top (100) table1 set field1 = 1