T-SQL Tutorial

Msg 120 Level 15 - INSERT statement


Transact SQL - the Msg 120 Level 15 - The select list for the INSERT statement contains fewer items than the insert list. The number of SELECT values must match the number of INSERT columns.

Msg 120 Level 15 Example:

Invalid insert:

USE model;
GO
insert into Customers(id,Name,City)
select Name, City from Students where id=3;
GO

Message
Msg 120, Level 15, State 1, Line 3
The select list for the INSERT statement contains fewer items than the insert list. The number of SELECT values must match the number of INSERT columns.




Correct insert:

USE model;
GO
insert into Customers(id,Name,City)
select 12, Name, City from Students where id=3;
GO

Other error messages: