开发者

what is wrong with this create table syntax

Here is my create table and this is the error I am getting

DROP TABLE IF EXISTS `teamfocus_dbo`.`sysdiagrams`;
CREATE TABLE `teamfocus_dbo`.`sysdiagrams` (
    `name` VAR开发者_StackOverflow社区CHAR(128) 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;

ERROR

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

I even tried to take out the UNIQUE line and still erroring...any ideas


-1 isn't a valid length for VARBINARY for most databases:

SQL Server: http://msdn.microsoft.com/en-us/library/ms188362.aspx

varbinary [ ( n | max) ]

Variable-length binary data. n can be a value from 1 through 8,000.

MySQL: http://dev.mysql.com/doc/refman/5.0/en/binary-varbinary.html

Refers to VARCHAR which provides the following limits:

The length can be specified as a value from 0 to 255 before MySQL 5.0.3, and 0 to 65,535 in 5.0.3 and later versions.

http://dev.mysql.com/doc/refman/5.0/en/char.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜