23.5k views
4 votes
In the INSERT statement that follows, assume that all of the table and column names are spelled correctly, that none of the columns are identity columns, and that none of them have default values or accept null values. What’s wrong with the statement?

1 Answer

4 votes

Answer:

The number of items in the column list doesn't match the number in the VALUES list.

Step-by-step explanation:

The statement is:

INSERT INTO InvoiceCopy

(VendorID, InvoiceNumber, InvoiceTotal, PaymentTotal, CreditTotal,

TermsID, InvoiceDate, InvoiceDueDate)

VALUES

(97, '456789', 8344.50, 0, 0, 1, '2016-08-01');

As clearly seen, there are 8 number of items (VendorID, InvoiceNumber, InvoiceTotal, PaymentTotal, CreditTotal, TermsID, InvoiceDate, InvoiceDueDate) but there are only 7 items in the values list.

Assuming the conditions given are true, it is seen the number of items in the column list does not match that of the values list, which identifies as a fault.

User Andrea Baccega
by
6.6k points