Skip to content
Advertisement

how can I Update top 100 records in sql server

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?

Advertisement

Answer

Note, the parentheses are required for UPDATE statements:

update top (100) table1 set field1 = 1
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement