On Jan 27, 2006, at 1:52 PM, Charles Baker wrote:

This script ran fine until it got to the end where some foreign keys are
being created

alter table pingtarget add constraint pingtarget_websiteid_fk
    foreign key (websiteid) references website(id);

alter table autoping add constraint autoping_websiteid_fk
    foreign key (websiteid) references website(id);

alter table autoping add constraint autoping_pingtargetid_fk
    foreign key (pingtargetid) references pingtarget(id);

alter table pingcategory add constraint pingcategory_autopingid_fk
    foreign key (autopingid) references autoping(id);

alter table pingcategory add constraint pingcategory_categoryid_fk
    foreign key (categoryid) references weblogcategory(id);

I get error 1005 from mysql. Google yielded a tip that an index should
be on the field before trying to create the foreign key. Using the first alter table statement as an example, would that mean that an index needs
to be created on website(id)?

Hmmm... since website.id is a primary key, it should already have an index.

Do the remaining alter table statements complete OK?

- Dave




----
Charles H. Baker
O: 864.422.5349 C: 864.201.8456
[EMAIL PROTECTED]
There's nothing wrong with getting a steady paycheck, unless it
interferes with your ability to earn what you're worth. There's the rub.
It usually does. -- T Harv Eker


Reply via email to