INSERT INTO gives errors

INSERT INTO gives errors

Post by Danial Codlin » Wed, 10 Sep 1997 04:00:00



I have an IDC file which simply populates a database on the SQL server
with the data the user has entered into a form.  The problem is that
everytime the IDC file is executed I get the following error message:

[State=21S01][Error=110][Microsoft][ODBC SQL Server Driver][SQL
Server]There are fewer 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.

Here is the following IDC file:

Datasource:     Web SQL
Username:       sa
Template:       add.htx
SQLStatement:
+USE Oldhamlink
+INSERT INTO links
+       (name, add1, add2, add3, town, postcode,
+       phone, email, cat, subcat, web)
+       VALUES
+       ( '%name%', '%add1%', '%add2%', '%add3%', '%town%',
'%postcode%',
+        '%phone%', '%email%', '%cat%', '%subcat%', '%web%')
+SELECT * FROM links
+       WHERE id = '%id%'

N.B. you may need to maximize your mail window as to not get confused
with the line breaks.

I can add records when using SQL Enterprize manager

If anyone can help with this problem it would be much appreciated

--
Thanks
------

Danial Codling
IT Support Engineer

KMP Internet
Regent House
Heaton Lane
Stockport
Cheshire
SK4 1BS

Tel: +44 (0161)-429-6590
Fax: +44 (0161)-476-6710

http://www.kmpinternet.com

 
 
 

INSERT INTO gives errors

Post by Richard Waymir » Wed, 10 Sep 1997 04:00:00


Just for fun, turn on sql trace and see what sql actually gets submitted to
sql server.
--
Richard Waymire, MCT, MCSE, MVP (SQLServer)
Principal Engineer, ARIS Corp.
President, Pacific NW SQLServer Users Group (http://www.pnwssug.org)
Visit us at http://www.aris.com



Quote:> I have an IDC file which simply populates a database on the SQL server
> with the data the user has entered into a form.  The problem is that
> everytime the IDC file is executed I get the following error message:

> [State=21S01][Error=110][Microsoft][ODBC SQL Server Driver][SQL
> Server]There are fewer 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.

> Here is the following IDC file:

> Datasource:     Web SQL
> Username:       sa
> Template:       add.htx
> SQLStatement:
> +USE Oldhamlink
> +INSERT INTO links
> +       (name, add1, add2, add3, town, postcode,
> +       phone, email, cat, subcat, web)
> +       VALUES
> +       ( '%name%', '%add1%', '%add2%', '%add3%', '%town%',
> '%postcode%',
> +        '%phone%', '%email%', '%cat%', '%subcat%', '%web%')
> +SELECT * FROM links
> +       WHERE id = '%id%'

> N.B. you may need to maximize your mail window as to not get confused
> with the line breaks.

> I can add records when using SQL Enterprize manager

> If anyone can help with this problem it would be much appreciated

> --
> Thanks
> ------

> Danial Codling
> IT Support Engineer

> KMP Internet
> Regent House
> Heaton Lane
> Stockport
> Cheshire
> SK4 1BS

> Tel: +44 (0161)-429-6590
> Fax: +44 (0161)-476-6710

> http://www.kmpinternet.com