You have a SQL Server 2008 database named Contoso with a table named Invoice. The primary key
of
the table is InvoiceId, and it is populated by using the identity property. The Invoice table is related
to the InvoiceLineItem table. You remove all constraints from the Invoice table during a data load to
increase load speed. You notice that while the constraints were removed, a row with InvoiceId = 10
was removed from the database. You need to reinsert
the row into the Invoice table with the same InvoiceId value.
Which TransactSQL statement should you use?
A.
INSERT INTO Invoice (InvoiceId, …
VALUES (10, …
B.
SET IDENTITY_INSERT Invoice ON;
INSERT INTO Invoice (InvoiceId, …
VALUES (10, …
SET IDENTITY_INSERT Invoice OFF;
C.
ALTER TABLE Invoice;
ALTER COLUMN InvoiceId int;
INSERT INTO Invoice (InvoiceId, …
VALUES (10, …
D.
ALTER DATABASE Contoso SET SINGLE_USER;
INSERT INTO Invoice (InvoiceId, …
VALUES (10, …
ALTER DATABASE Contoso SET MULTI_USER;
Explanation: