tags:

views:

37

answers:

2
CREATE TABLE  `surfkid-db`.`Channels` (`name` VARCHAR( 30 ) NOT NULL ,`commercial` BOOL( 1 ) NOT NULL DEFAULT  '0' AUTO_INCREMENT ,`usrid` INT( 5 ) NOT NULL DEFAULT  '0' AUTO_INCREMENT ,`id` INT( 5 ) NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE = MYISAM ;

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 '(1) NOT NULL DEFAULT '0' AUTO_INCREMENT, `usrid` INT(5) NOT NULL DEFAULT '0' AUT' at line 1 

I Couldn`t provide to error message, sorry please help

+4  A: 

I believe that only INTs can be AUTO_INCREMENT, and I'm fairly sure that only the primary key can be auto-incremented.

Thomas
+1  A: 

You don't need specify size for BIT and INT fields, also AUTO_INCREMENT does not apply to BOOL. Try this instead:

CREATE TABLE  `surfkid-db`.`Channels` 
(
  `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `name` VARCHAR(30) NOT NULL ,
  `commercial` BOOL NOT NULL DEFAULT  0,
  `usrid` INT NOT NULL DEFAULT  0
)
Jose Basilio