I have a question about the using an expression in UPDATE (UPDLOCK, READPAST, ROWLOCK)
. When I use to specific row I know it works, but when I use a condition that allows search lists I don't know work, for example:
Specific row
UPDATE TABLE
FROM table AS TABLE WITH(UPDLOCK, READPAST, ROWLOCK)
WHERE ID = 1
List rows
UPDATE TABLE
FROM table AS TABLE WITH(UPDLOCK, READPAST, ROWLOCK)
WHERE
STATUS = 'OK' AND
NAME LIKE 'AB%'
In the second example, I don't know if using (UPDLOCK, READPAST, ROWLOCK)
will be efficient, if it will lock many pages to find the records.