"Error: You have an error in your SQL syntax;

Hi everyone,
I'm learning Node-RED, i've hit a wall with this error -

"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 ''Timestamp','Values')VALUES('07/12/2022, 13:58:08', 13)' at line 1"

It is a very basic flow, first of all i was writing only the value to mySQL and had no problems.
I've now added a second column called 'Timestamp' and i'm returning the error above.

Please can anyone help me with this?

What version of sql are you using (MySQL, MSSQL etc)?
What does you version define a timestamp as?
Does the data you are inserting match the data type of what you have defined?


I'm using mySQL.

Where it refers to 'line 1' in the error message, does that mean the issue lies within the first line of the code, i.e. value1? If so, that is very strange because i have been recording that value in a single column to test it for a few days. The issue has only appeared since adding the second column in mySQL.

The DATETIME type is used for values that contain both date and time parts. MySQL retrieves and displaysDATETIME values in 'YYYY-MM-DD hh:mm:ss' format. The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'

It looks like your date time is mm-did-yyyy format when it should Year first

Thanks, i have got it to work for now using VARCHAR(45).
I'm not sure how to change the date format.

If you are i control of the schema and not too much data has been added, why not use timestamp instead. Here is a site explaining it

1 Like

Debugging a SQL query
Go to the line that is failing in your SQL query.
Check the SQL syntax on the line that is failing in your SQL query.
Check your query logic if the query uses joins, subqueries, or CTEs.
If you get an error message that isn't specific to your SQL query, go to Troubleshooting error messages.
Regards,
Rachel Gomez

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.