Friday 29 March 2019

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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...