Insert with Output in SQL Server

Posted by Joe Enos on February 14, 2021 · 1 min read

When inserting records in SQL Server, you can output the results into a temporary or real table, with the OUTPUT clause.

This can be used to return database-generated values without a secondary select, or to act similarly to a trigger, giving you the ability to do something after records get inserted.

View code on GitHub