Using INSERT / OUTPUT in a SQL Server Transaction

Posted on SQL Server Central See other posts from SQL Server Central
Published on Mon, 27 Dec 2010 07:00:00 UT Indexed on 2010/12/27 8:57 UTC
Read the original article Hit count: 169

Filed under:
Frequently I find myself in situations where I need to insert records into a table in a set-based operation wrapped inside of a transaction where secondarily, and within the same transaction, I spawn-off subsequent inserts into related tables where I need to pass-in key values that were the outcome of the initial INSERT command. Thanks to a Transact/SQL enhancement in SQL Server, this just became much easier and can be done in a single statement... WITHOUT A TRIGGER!
SQL Backup Join SQL Backup’s 35,000+ customers
to compress and strengthen your backups

"SQL Backup will be a REAL boost to any
DBA lucky enough to use it." Jonathan Allen.
Download a free trial now.

© SQL Server Central or respective owner