SQL Capturing Updated records


Example

Sometimes one wants to capture the records that have just been updated.

CREATE TABLE #TempUpdated(ID INT)

Update TableName SET Col1 = 42
    OUTPUT inserted.ID INTO #TempUpdated
    WHERE Id > 50