tags:

views:

39

answers:

2

SQL statement:

INSERT INTO order (`ORDER_ID`,`SALE_CODE`,`CREATED_AT`,`UPDATED_AT`) VALUES ('2646253286','HPHS20','2009-07-11 12:07:40','2009-07-11 12:07:40')

Error:

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 'order (`ORDER_ID`,`SALE_CODE`,`CREATED_AT`,`UPDATED_AT`) VALUES ('2646253286','H' at line 1
+4  A: 

You have a table called order which is a reserved word in SQL. I'm not exactly sure how to get around it in MySQL, but in SQL Server it would be something like

insert into [order] ...
banjollity
Oh, of course. Thanks for the help!
James Skidmore
Actually, in SQL Server, you'd use [tablename] to fix this. The databasename prefix won't work, because even if you do use it you'd then need the schema (2005 onwards) or owner (2000 backwards) in between.
David M
@David M - thanks for that.
banjollity
+4  A: 

Fix backticks (`) around order to fix this.

orlandu63