declare @date datetime
declare @max int
declare @owner int
update top (@max) Timers set
StateId = 2
where
StateId = 1
and CreationDate < @date
and OwnerId = @owner
You have 2 options:
1- Fetch the entities you want to update first and then update them.
2- Re-write the query as follows:
update Timers set
StateId = 2
where
id IN ( Select top (@max) id
From Timers
Where
StateId = 1
and CreationDate < @date
and OwnerId = @owner)
And the IN predicate can be implemented using a FieldCompareSetPredicate.