Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
i am getting the following error while i running my ASP.Net Application in Server,
what may be the solution?
 
There are more 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.
Posted 7-Feb-13 23:03pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

This error message appears when you try to INSERT a row into a table and there are more columns in that table than you have supplied in the VALUES clause.
 
For ex;
USE tempDB
GO
CREATE TABLE #t
(
 c1 INT
 , c2 INT
)
INSERT INTO #t (c1, c2) VALUES(1)
 
As you can see in the above example the table #t contains the column c1 and c2. In the INSERT statement which is intended to affect both columns c1 and c2, however, there is only 1 value supplied. In order to successfully run the INSERT statement, you need to correct either the column list or the VALUES list. Both must contain exactly the same number of arguments.
 
Good luck,
OI
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

The number of values that you are trying to insert is much more than the columns in your database table.
if it is a long SQL query then paste it into excel or notepad or something and verify it. It is a pain, I get it often as well
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 400
1 Sergey Alexandrovich Kryukov 329
2 Afzaal Ahmad Zeeshan 264
3 BillWoodruff 245
4 CPallini 195
0 OriginalGriff 5,560
1 DamithSL 4,476
2 Maciej Los 3,942
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,175


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 8 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100