You have been tasked with creating a table named dbo.Widgets. You need to insert five rows into
the
dbo.Widgets table and return WidgetID for each of the five rows that have been inserted.
Which TransactSQL
batch should you use?
A.
CREATE TABLE dbo.Widgets (
WidgetID INT IDENTITY PRIMARY KEY,
WidgetName VARCHAR(25));
GO
INSERT dbo.Widgets (WidgetName)
OUTPUT inserted.WidgetID, inserted.WidgetName
VALUES
(‘WidgetOne’),(‘WidgetTwo’),(‘WidgetThree’),(‘WidgetFour’),(‘WidgetFive’);
B.
CREATE TABLE dbo.Widgets (
WidgetID INT IDENTITY PRIMARY KEY,
WidgetName VARCHAR(25) );
GO
INSERT dbo.Widgets (WidgetName)
VALUES
(‘WidgetOne’),(‘WidgetTwo’),(‘WidgetThree’),(‘WidgetFour’),(‘WidgetFive’);
SELECT SCOPE_IDENTITY();
C.
CREATE TABLE dbo.Widgets (
WidgetID UNIQUEIDENTIFIER PRIMARY KEY,
WidgetName VARCHAR(25) );
GO
INSERT dbo.Widgets (WidgetName)
VALUES
(‘WidgetOne’),(‘WidgetTwo’),(‘WidgetThree’),(‘WidgetFour’),(‘WidgetFive’);
SELECT SCOPE_IDENTITY();
D.
CREATE TABLE dbo.Widgets (
WidgetID UNIQUEIDENTIFIER PRIMARY KEY,
WidgetName VARCHAR(25));
GO
INSERT dbo.Widgets (WidgetName)
OUTPUT inserted.WidgetID, inserted.WidgetName
VALUES
(‘WidgetOne’),(‘WidgetTwo’),(‘WidgetThree’),(‘WidgetFour’),(‘WidgetFive’);