3

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

5
  • Good Question. And I will add that "near bla bla" is extremely frustrating at times, because it is like asking "where is the Statue of Liberty" and getting the answer "Somewhere in New York". Commented Sep 20, 2012 at 21:24
  • Sorry I should put some specific error words there? Commented Sep 20, 2012 at 21:25
  • It shows you exactly where the error begins. Sometimes it's not particularly obvious, such as using a reserved word incorrectly, so even if the displayed snippet LOOKS ok, it really isn't. Commented Sep 20, 2012 at 21:28
  • @MarcB. You are right. I have tried to reply this question/answer in comment under Alain's answer. But surely I have to live with it, if it is the only answer :) Commented Sep 20, 2012 at 21:37
  • 1
    @sami: a syntax error is a syntax error. MySQL can't tell you it's a reserved word in the wrong place, because they're just that... reserved. MySQL only sees what you enter, it can't read your mind, so it can't know that you acidentally 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. Commented Sep 20, 2012 at 21:39

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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

5 Comments

Sure that is. But many times it tells error something like 'invalid field name amount' which is some more decent. I was asking if I could do something to get all or most of the errors in this way.
You'll get more specific errors once you get past the syntax stage :(
Bitter truth :( But seems the fact :)
Is this decent when it says near '' and i find '' no where?
Nope, not decent. If you can't spot it, post it and maybe someone can help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.