2

I have a problem with my database. I have created the model and now I want to sync it with my database on my WAMP Server (local) but it keeps giving me an error. I searched for the cause of the error for several days. Since I cannot find the problem, I've decided to share it with you.

Message log:

Executing SQL script in server
ERROR: Error 1064: 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 ') NULL DEFAULT NULL , n_category VARCHAR(45) NULL DEFAULT NULL , 
PRIMARY K' at line 3
CREATE TABLE IF NOT EXISTS `telo2p`.`d_category` 
(
 `idd_category` INT(11) NOT NULL AUTO_INCREMENT,
 `f_sells` DOUBLE(11) NULL DEFAULT NULL,
 `n_category` VARCHAR(45) NULL DEFAULT NULL,
 PRIMARY KEY (`idd_category`) 
)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
COLLATE = utf8_general_ci
SQL script execution finished: statements: 6 succeeded, 1 failed

http://img855.imageshack.us/img855/4855/21725619.png

Any advice about what I am doing wrong here?

Hannah Vernon
71.1k22 gold badges178 silver badges323 bronze badges
asked Apr 14, 2012 at 9:49

1 Answer 1

2

Remove the (11) from the DOUBLE(11):

`f_sells` DOUBLE NULL DEFAULT NULL ,

Approximate numeric dataypes (Float and Double) need no parameter. There is also a non-standard syntax with 2 parameters. From the MySQL docs, Floating-Point Types (Approximate Value):

MySQL allows a nonstandard syntax: FLOAT(M,D) or REAL(M,D) or DOUBLE PRECISION(M,D). Here, "(M,D)" means that values can be stored with up to M digits in total, of which D digits may be after the decimal point. For example, a column defined as FLOAT(7,4) will look like -999.9999 when displayed. MySQL performs rounding when storing values, so if you insert 999.00009 into a FLOAT(7,4) column, the approximate result is 999.0001.

answered Apr 14, 2012 at 12:24
1
  • ok you know what is the thing that i have thought that thing and i remove more my eer model the (11) and for some reason when i choose Database -> sync model ! and i have put there only double without (11) it put it automatically but if i remove them from the script before i execute it all goes smooth. Commented Apr 14, 2012 at 13:06

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.