Wednesday, May 30, 2018

mysql - SQL - Syntax error near ','

I can't for the life of me figure out why this query won't work no matter which one of my local databases I try (oracle, mysql, microsoft sql).




INSERT INTO testtable
VALUES ( 'testvalue' , 12345678, 123.04, 0, '1950-01-03' )


For example, with Microsoft SQL Server I get an Error near ','.



With MySQL I get



You have an error in your SQL syntax near '12345678, 123.04, 0, )' at line 2.




I've tried playing with it, I've looked at W3 school for the syntax of INSERT INTO. Everything looks good. What could it be?



Thank you!



EDIT:



As requested: here's the layout for mysql





+------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+-------+
| TestString | varchar(600) | NO | | NULL | |
| TestInt | int(11) | NO | | NULL | |
| TestDouble | double | NO | | NULL | |
| Testbool | tinyint(1) | NO | | NULL | |
| TestDate | date | NO | | NULL | |
+------------+--------------+------+-----+---------+-------+



Also, it should be noted I can run a parameterized query using these values and it will work just fine. It's only when I go to manually create the query that it's a problem.

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...