Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Inserting and updating NULLs
Conditions in UPDATE and DELETE
Using values from another column
Return rows in INSERT, UPDATE, DELETE
16. Display values when inserting multiple rows
Summary

Instruction

Great! The OUTPUT clause can also be used in an INSERT query with multiple rows:

INSERT INTO Student 
OUTPUT Inserted.*
VALUES
(14, N'Sandra', NULL, N'Norman'),
(15, N'Martin', N'Gary', N'Klain');

The statement above inserts two records using just one operation. With OUTPUT, you can display all the inserted data.

Exercise

Insert new students into the Student table: Joanna Maria Pearson with Id = 16 and John Porter (who doesn't have a middle name) with Id = 17. Display inserted data.