Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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

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

change to

  `Active` TINYINT NOT NULL DEFAULT 0,
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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