1

I have another syntax error when migrating a diagram. I'm not certain this diagram is necessary, but it would be nice to have a smooth migration, and this is all that's standing in the way.

The error is: 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) NULL, PRIMARY KEY ('diagram_id'), UNIQUE INDEX 'UK_principal_name' ('pri' at line 6

And the syntax has a VARBINARY(-1) which I've never seen before. Is that the problem?

DROP TABLE IF EXISTS `Fonebook_dbo`.`sysdiagrams`;
CREATE TABLE `Fonebook_dbo`.`sysdiagrams` (
  `name` VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `principal_id` INT(10) NOT NULL,
  `diagram_id` INT(10) NOT NULL AUTO_INCREMENT,
  `version` INT(10) NULL,
  `definition` VARBINARY(-1) NULL,
  PRIMARY KEY (`diagram_id`),
  UNIQUE INDEX `UK_principal_name` (`principal_id`, `name`)
)
ENGINE = INNODB;
0

VARBINARY(-1), -1 is a length of binary. Set the correct length, such 100

  `definition` VARBINARY(100) NULL,
  • I ended up ignoring the object altogether, thanks. – David Fox Sep 22 '10 at 16:35
1

I'm not experienced with the data type but I'm guessing that is the issue:

The permissible maximum length is the same for BINARY and VARBINARY as it is for CHAR and VARCHAR, except that the length for BINARY and VARBINARY is a length in bytes rather than in characters.

So yeah, I don't think negative 1 bytes is a valid length.

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.