MySQL Forums
Forum List  »  Newbie

I can't use CHECK command?
Posted by: oliver mohr
Date: June 07, 2012 05:44PM

I'm getting the following error when trying to use CHECK command:

-- -----------------------------------------------------
-- Table `aaa`.`empleado`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `aaa`.`empleado` (

`rut_e` INT( 8 ) NOT NULL ,
`nombre` VARCHAR( 35 ) NOT NULL ,
`apelido` VARCHAR( 35 ) NOT NULL ,
`calle_nro` VARCHAR( 35 ) NOT NULL ,
`comuna` VARCHAR( 35 ) NOT NULL ,
`region` VARCHAR( 35 ) NOT NULL ,
`fecha_contrato` DATE NOT NULL ,
`tipo_empleado` VARCHAR( 1 ) NOT NULL `rut_a_fk` INT( 8 ) NULL ,
CHECK (
`tipo_empleado` IN (
`a` ,
`v` ,
`j`
)
),
PRIMARY KEY ( `rut_e` ) ,
INDEX `rut_a_fk` ( `rut_a_fk` ASC ) ,
CONSTRAINT `rut_a_fk` FOREIGN KEY ( `rut_a_fk` ) REFERENCES `aaa`.`administrador` (
`rut_a`
) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE = INNODB;



MySQL ha dicho:

#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 '`rut_a_fk` INT(8) NULL ,
CHECK (`tipo_empleado` IN (`a`,`v`,`j`)),

PRI' at line 14

Options: ReplyQuote


Subject
Written By
Posted
I can't use CHECK command?
June 07, 2012 05:44PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.