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
 where is the syntax error in this query?

Author  Topic 

jpcaps
Starting Member

2 Posts

Posted - 2010-10-21 : 18:35:52
fields:
order_num int(11) not null
order_date date not null
cust_id char(10) not null


SQL query:

INSERT INTO orders( order_num, order_date, cust_id )
VALUES ( 20005, '2001-05-01', '1000000001' ) ,
VALUES ( 20006, '2001-01-12', '1000000003' ) ,
VALUES ( 20007, '2001-01-30', '1000000004' ) ,
VALUES ( 20008, '2001-02-03', '1000000005' ) ,
VALUES ( 20009, '2001-02-08', '1000000001' )

MySQL said:

#1064 - 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 'values (20006,'2001-01-12','1000000003'),
values (20007,'2001-01-30','100000000' at line 3

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-10-22 : 00:08:46
This is a MS SQL Server forum, so you might find better help at a mySQL site, but I think that you need to enclose your field names in backticks like this:

INSERT INTO orders( `order_num`, `order_date`, `cust_id` )
Go to Top of Page
   

- Advertisement -