views:

101

answers:

1

Can anyone see what I am missing? the section of my script below fails with the following message:

ERROR 1064 (42000) at line 26: 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 ') , PRIMARY KEY (id), INDEX fk_gaprodsku_gatransid (transactionid ASC)' at line 5

I'm stumped. Script (1st line is line #26):

CREATE TABLE IF NOT EXISTS `mydb`.`ga_product_sku` (
  `id` INT NOT NULL AUTO_INCREMENT ,
  `productsku` VARCHAR(45) NOT NULL ,
  `transactionid` VARCHAR(45) NOT NULL ,
   UNIQUE INDEX () ,
   PRIMARY KEY (`id`) ,
   INDEX `fk_gaprodsku_gatransid` (`transactionid` ASC) ,
   CONSTRAINT `fk_gaprodsku_gatransid`
   FOREIGN KEY (`transactionid` )
   REFERENCES `mydb`.`ga_transaction_id` (`transactionid` )
   ON DELETE CASCADE
   ON UPDATE CASCADE
) ENGINE = InnoDB;

any insight is appreciated. thx

+1  A: 

Seems, you don't name any columns in the UNIQUE INDEX constraint.

CREATE TABLE IF NOT EXISTS mydb.ga_product_sku ( 
  id INT NOT NULL AUTO_INCREMENT , 
  productsku VARCHAR(45) NOT NULL , 
  transactionid VARCHAR(45) NOT NULL , 

  UNIQUE INDEX () , -- There should be at least one column name between ()

  PRIMARY KEY (id) , 

  INDEX fk_gaprodsku_gatransid (transactionid ASC) , 

  CONSTRAINT fk_gaprodsku_gatransid 
    FOREIGN KEY (transactionid ) 
    REFERENCES mydb.ga_transaction_id (transactionid ) 
    ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB;
Dirk
Thanks Dirk, I knew it was something that had to be simple that I just wasn't seeing, i appreciate the assist.
jonny