0
votes

I am facing an error while running a SQL query.

The error I am receiving is:

(102, b"Incorrect syntax near '2020-01-31 00:00:00'.DB-Lib error message 102, severity 15:\nGeneral SQL Server error: Check messages from the SQL Server\nDB-Lib error message 102, severity 15:\nGeneral SQL Server error: Check messages from the SQL Server\nDB-Lib error message 102, severity 15:\nGeneral SQL Server error: Check messages from the SQL Server\n")

Since the query is lengthy, I am putting only part of the query where the error is being shown:

T1.submit_date < ts '2020-01-31 00:00:00'

If need be, I will edit and put the entire query.

Any help is appreciated.

Thank you.

1
what is ts here ? - Red Devil
This is SQL Server (Microsoft SQL, MS SQL) error message, not MySQL message. Compare one more time letter-by-letter: MS SQL and MySQL. - Akina
Hi Red. ts is timestamp, an ODBC literal escape sequence. More information here: stackoverflow.com/questions/15759458/… - DHRUV KAUSHAL
Hi Akina. It is MySQL that I am using in the backend. I am unclear on a thing. Are you suggesting that I should change the title of my question and the tags? I think the server is throwing an error because of something wrong in the query. - DHRUV KAUSHAL
Oh really sorry guys. I am new to databases and didn't know that these two are two different technologies themselves. { insert embarrassed emoji here } - DHRUV KAUSHAL

1 Answers

2
votes

This is not the correct format for ODBC escape sequences. It should be wrapped in {}

where T1.submit_date < {ts '2020-01-31 00:00:00'}