Transact SQL - the Msg 110 Level 15 - There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
Msg 110 Level 15 Example:
We have the table Library:
USE model;
GO
CREATE TABLE Library(
Id int,
Title varchar(255),
Student_id int );
GO
Invalid insert:
USE model;
GO
INSERT INTO Library(id, title)
VALUES (4,'PHP',1), (5,'CSS',2);
GO
Message |
---|
Msg 110, Level 15, State 1, Line 3 |
There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement. |
Correct insert:
USE model;
GO
INSERT INTO Library(id, title, student_id)
VALUES (4,'PHP',1), (5,'CSS',2);
GO