{"id":215,"date":"2012-05-17T05:40:38","date_gmt":"2012-05-17T05:40:38","guid":{"rendered":"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\/"},"modified":"2012-05-17T05:40:38","modified_gmt":"2012-05-17T05:40:38","slug":"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","status":"publish","type":"post","link":"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\/","title":{"rendered":"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."},"content":{"rendered":"
Error Message:<\/strong> This error occurs when the select clause contains more number of columns then that present in the insert clause.<\/p>\n Example:<\/strong> INSERT INTO @VTABLE(ID) Fix\/Resolution:<\/strong> Update the select statement with the number of columns equal to that of insert statement. INSERT INTO @VTABLE(ID,NAME) Update the insert statement with the number of columns equal to that of select statement. INSERT INTO @VTABLE(ID) 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.…<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1988,128],"tags":[1989,1990],"class_list":["post-215","post","type-post","status-publish","format-standard","hentry","category-msg-121","category-sql-errors","tag-msg-121-level-15-state-1-line-3","tag-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"],"_links":{"self":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts\/215","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/comments?post=215"}],"version-history":[{"count":0,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts\/215\/revisions"}],"wp:attachment":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/media?parent=215"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/categories?post=215"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/tags?post=215"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
\n
\nMsg 121, Level 15, State 1, Line 3
\nThe 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.
\n<\/font><\/p>\n
\n[sql]
\nDECLARE @VTABLE table(ID INT, NAME VARCHAR(100))<\/p>\n
\nSELECT 1,’Devi’
\n[\/sql]<\/p>\n
\nMake the number of columns in select statement and insert statement equal<\/p>\n
\n[sql]
\nDECLARE @VTABLE table(ID INT, NAME VARCHAR(100))<\/p>\n
\nSELECT 1,’ABC’
\n[\/sql]<\/p>\n
\n[sql]
\nDECLARE @VTABLE table(ID INT, NAME VARCHAR(100))<\/p>\n
\nSELECT 1
\n[\/sql]<\/p>\n","protected":false},"excerpt":{"rendered":"