Sami
Sami

Reputation: 8429

How to get syntax error's specific description in mysql

My specific problem is solved before completing the question. But I still have a general question. It might be a duplicate but I am sorry I have been unable to find it on SO or elsewhere.

I have a table named reports. There is one row containing data. When I was trying to execute an update query I get an error:

error 1064: There is an error in your sql syntax near 'table='defect',Filter='' ,dtFilter='',query='Select allfields from defect' ,`da' at line 1

My question: is there a way to get my specific error? As it was just telling that there is error in SQL syntax but nothing about what type of error is.

Do I always have to google for such errors or there exists some technique to get their exact specific description locally?

Background (optional reading): after normal googling I got hint while posting question for better googling and get solved my specific problem as I came to know that it was problem of reserve words table and datetime. The problem solved when I put quotes around those words. This usually happens with me. But my general problem is still there...

It my be of no use now but I am sharing my schema here on sqlfiddle it might be useful

Upvotes: 3

Views: 186

Answers (2)

Sami
Sami

Reputation: 8429

MySQL can't tell you that you are using a reserved word in wrong place (or your place is correct but used word is a reserve word, it cant differentiate) , it only only sees what you enter, it can't read the mind, so it can't know that you accidentally used (say) order as a field name, it'll just see a valid part of a query in the wrong place.e.g... a syntax error. It also won't report on ALL syntax errors in a query, because one syntax error renders the whole thing wrong. it can't skip over a word and keep parsing.

Upvotes: 2

Alain Collins
Alain Collins

Reputation: 16362

Nope - it just tells you the position, which hopefully is a decent clue.

Upvotes: 1

Related Questions