O'Reilly logo

Inside Microsoft® SQL Server® 2008: T-SQL Querying by Lubor Kollar Itzik Ben-Gan Dejan Sarka, and Steve Kass

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

OUTPUT Clause

SQL Server supports returning output from a data modification statement via the OUTPUT clause. The OUTPUT clause is supported for INSERT, DELETE, UPDATE, and MERGE statements. In the OUTPUT clause, you can refer to the special tables inserted and deleted. These special tables contain the rows affected by the data modification statement—in their new (after-modification) and old (before-modification) versions, respectively. You use the inserted and deleted tables here much like you do in triggers. With INSERTs, you refer to the inserted table to identify attributes from the new rows. With DELETEs, you refer to the deleted table to identify attributes from the old rows. With UPDATEs, you refer to the deleted table to identify the attributes ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required