Msg 121 Level 15 State 1 Line 3 The select list for the INSERT statement contains more items than the insert list. The number of SELECT values must match the number of INSERT columns. – SQLSERVERLEARNER https://sqlserverlearner.com LEARN SQL SERVER ONLINE Thu, 17 May 2012 05:40:38 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.3 The select list for the INSERT statement contains more items than the insert list. The number of SELECT values must match the number of INSERT columns. https://sqlserverlearner.com/2012/05/17/the-select-list-for-the-insert-statement-contains-more-items-than-the-insert-list-the-number-of-select-values-must-match-the-number-of-insert-columns/ https://sqlserverlearner.com/2012/05/17/the-select-list-for-the-insert-statement-contains-more-items-than-the-insert-list-the-number-of-select-values-must-match-the-number-of-insert-columns/#respond Thu, 17 May 2012 05:40:38 +0000 https://sqlserverlearner.azurewebsites.net/2012/05/17/the-select-list-for-the-insert-statement-contains-more-items-than-the-insert-list-the-number-of-select-values-must-match-the-number-of-insert-columns/ Error Message:

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

This error occurs when the select clause contains more number of columns then that present in the insert clause.

Example:
[sql]
DECLARE @VTABLE table(ID INT, NAME VARCHAR(100))

INSERT INTO @VTABLE(ID)
SELECT 1,’Devi’
[/sql]

Fix/Resolution:
Make the number of columns in select statement and insert statement equal

Update the select statement with the number of columns equal to that of insert statement.
[sql]
DECLARE @VTABLE table(ID INT, NAME VARCHAR(100))

INSERT INTO @VTABLE(ID,NAME)
SELECT 1,’ABC’
[/sql]

Update the insert statement with the number of columns equal to that of select statement.
[sql]
DECLARE @VTABLE table(ID INT, NAME VARCHAR(100))

INSERT INTO @VTABLE(ID)
SELECT 1
[/sql]

]]>
https://sqlserverlearner.com/2012/05/17/the-select-list-for-the-insert-statement-contains-more-items-than-the-insert-list-the-number-of-select-values-must-match-the-number-of-insert-columns/feed/ 0