Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 What is the maximum columns in INSERT statement ??

Author  Topic 

vaibhavpingle
Starting Member

28 Posts

Posted - 2007-02-24 : 06:22:56
Hello friends,

I am sorry to be posting this message in this forum. But thought if anyone does have any idea abt my problem, which i illustrate below.

I want to know what is the maximum number of columns that an INSERT statement can handle?

I have come across a situation where i need to insert 15 values in a table.

INSERT INTO myTable (col1, col2, col3,....., col15) VALUES (v1, v2, v3,...., v15).

Actual statement:

INSERT INTO BillSell (bnumber, stock, qty, price, tprice, seen, bill_id, brokerage, service_tax, brok_st, stt, brok_st_stt, total_cost, total_rate_pu, check)
VALUES ('ICICI 06-12-2004 reshma', 'RELIND', 10, 541.7375183271872, 5417.375183271873, 'no', 2402, 40.2375, 4.92507, 45.162569999999995, 6.771718979089841, 51.934288979089835, 5365.0, 536.5, 'check')



When I call this in Java program, it asks me to check the syntax of the statement as follows :

com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'check) VALUES ('ICICI 06-12-2004 reshma', 'RELIND', 10, 541.7375183271872, 5417.' at line 1

Please make notice that all the data types of the table columns and the values passed in the statement match.

Now the problem is that, when from the above INSERT statement, i remove the last column (i.e. the "check" column and its corresponding value passed i.e. 'check'), the code works fine. I observe here that now there are 14 columns in the statement.

So i need the solutions for this. I cannot move further in the program......

Please help.

Trust in Technology mate .....'Not in Human Beings'

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-02-24 : 07:20:46
what is your database ? MySQL or MS SQL server ? Do you know that this is a Microsoft SQL Server site ?


KH

Go to Top of Page

vaibhavpingle
Starting Member

28 Posts

Posted - 2007-02-24 : 07:22:55
well i have already apologized for postingon this site...........its mysql

Trust in Technology mate .....'Not in Human Beings'
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-24 : 10:24:09
Maybe check is a reserved word?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -