I’d like to update a set of rows based on a simple criteria and get the list of PKs that were changed. I thought I could just do something like this but am worried about possible concurrency problems:
SELECT Id FROM Table1 WHERE AlertDate IS NULL; UPDATE Table1 SET AlertDate = getutcdate() WHERE AlertDate IS NULL;
If that is wrapped in a transaction are there any concurrency issues that can occur? Or is there a better way to do this?
Consider looking at the OUTPUT clause: