Click here to Skip to main content
15,893,337 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

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;
SQL
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
 
Share this answer
 
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
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900