0

What is the problem with this query?

INSERT INTO acfrac (username,id,count,time) VALUES ("John Smith", 10, 0,2006-06-07 09:44:33.0)

It gives me the following 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 '09:44:33.0)' at line 1

1
  • In addition to quoting problems, count is reserved word. You almost certainly need to escape it. ie enclose it in back tics. Commented May 18, 2012 at 6:46

3 Answers 3

2

You need to quote your time stamp. In mysql, if the field you're entering is not an integer, it must be quoted.

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

Comments

1

Try this:

INSERT INTO acfrac (username,id,count,time) VALUES ("John Smith", 10, 0,'2006-06-07 09:44:33.0')

The date and datetime values need to be enclosed in single quotes.

Comments

1

I just encounter the same problem with you, I just saw the comment and add quotes with my time-stamp data type column and finally it going to work. It helps me a lot.

Comments

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.