1

There is something wrong with the SQL after this error, and I'm not sure what.

Error: You have an error in your SQL Syntax. Please check the manual that corresponds to your MySQL server version for the right syntax to use near '(0), PRIMARY KEY (AddressID), CONSTRAINT FK_Address_Profile FOREIGN KEY ' at line 15

and here is the create syntax:

DROP TABLE IF EXISTS `MyDB_dbo`.`Address`;
CREATE TABLE `MyDB_dbo`.`Address` (
  `AddressID` INT(10) NOT NULL AUTO_INCREMENT,
  `ProfileID` INT(10) NOT NULL,
  `Address1` VARCHAR(100) NOT NULL,
  `Address2` VARCHAR(100) NULL,
  `City` VARCHAR(50) NOT NULL,
  `State` VARCHAR(50) NOT NULL,
  `ZipCode` VARCHAR(50) NOT NULL,
  `ZipPlus` VARCHAR(6) NULL,
  `Country` VARCHAR(50) NULL,
  `MailReturned` DATETIME NULL,
  `DPVStatus` VARCHAR(1) NULL,
  `DateCreated` DATETIME NOT NULL,
  `StaffID` INT(10) NOT NULL,
  `Active` TINYINT NOT NULL DEFAULT (0),
  PRIMARY KEY (`AddressID`),
  CONSTRAINT `FK_Address_Profile` FOREIGN KEY `FK_Address_Profile` (`ProfileID`)
    REFERENCES `MyDB_dbo`.`Profile` (`ProfileID`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION
)
ENGINE = INNODB;

Is there something wrong with the CONSTRAINT keyword or something?

1

Should there be () around the DEFAULT (0)?

  • Thanks, that was it. I have another syntax error I'm about to post related to a diagram in SQL Server. – David Fox Sep 21 '10 at 21:10
0
  `Active` TINYINT NOT NULL DEFAULT (0),

change to

  `Active` TINYINT NOT NULL DEFAULT 0,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.