sql - Why does this MySQL Create Table statement fail? -
using mysqladmin tool, try create table. tool generates sql statement, , replorts "can't create table" no other clue on error is!
here :
create table `c121535_vubridge`.`products` ( `pr_id` integer unsigned not null auto_increment, `pr_name` varchar(45) not null, `pr_type` varchar(2) not null comment 'h=hand series v=vubridge software e=event subs s=sponsoring', `pr_authorid` integer unsigned comment '= m_id (for bridge hand series', `pr_sponsorid` integer unsigned not null, `pr_datecreation` datetime not null, `pr_price` float not null, `pr_descriptiontext` text, `pr_description` varchar(245), primary key (`pr_id`), constraint `fk_prauthor` foreign key `fk_prauthor` (`pr_authorid`) references `members` (`m_id`) on delete set null on update no action, constraint `fk_sponsor` foreign key `fk_sponsor` (`pr_sponsorid`) references `members` (`m_id`) on delete set null on update no action ) engine = innodb; can help?
the create table works me if omit foreign key references:
create table `products` ( `pr_id` integer unsigned not null auto_increment, `pr_name` varchar(45) not null, `pr_type` varchar(2) not null comment 'h=hand series v=vubridge software e=event subs s=sponsoring', `pr_authorid` integer unsigned comment '= m_id (for bridge hand series', `pr_sponsorid` integer unsigned not null, `pr_datecreation` datetime not null, `pr_price` float not null, `pr_descriptiontext` text, `pr_description` varchar(245), primary key (`pr_id`) ) ...so i'm inclined believe c121535_vubridge.members not exist. c121535_vubridge.members needs created before create table statement products table run.
Comments
Post a Comment