• psmith-502573 - Thursday, May 25, 2017 6:04 AM

    I see UPDATE mentioned in the article but no references as to how to use it with OUTPUT

    MIcrosoft Documentation: UPDATE (Transact-SQL)

    Useful for historical logging, the values present have the before and after values for the columns that are changed using the monikers of deleted and inserted


    DECLARE  @Output TABLE ( ValueOld VARCHAR(100), ValueNew VARCHAR(100) )

    UPDATE   TableName
    SET      ColumnName = @NewValue
    OUTPUT   deleted.ColumnName, inserted.ColumnName INTO @Output
    WHERE    TableIndex = @TableIndex