I need help in updating the initial 100 rows of a table in SQL Server. The table, named EmployeeTable, contains two columns: SalaryValue and JobStatus, and holds exactly 200 rows. My aim is to adjust the SalaryValue for the first 100 entries according to a specific criterion. What SQL query can accomplish this update using the equivalent of the TOP 100 clause?
Below is one sample approach:
WITH InitialRows AS (
SELECT TOP (100) OrderID, SalaryValue
FROM EmployeeTable
ORDER BY OrderID
)
UPDATE InitialRows
SET SalaryValue = SalaryValue + 500;
Any guidance would be appreciated.