forums › forums › SQLyog › Using SQLyog › trouble with setting One to many relartion
- This topic is empty.
-
AuthorPosts
-
-
May 3, 2004 at 1:56 pm #8419dahuan60Member
I have two tables with one to many relationship. I got error message ” Could not create relationship. The possible is:….”.
I checked five posible problems and still got same message?
Changed both tables type to InnoDB.
Table1: (Index: 1.TagID unique 2. ContNum )
TagID(PK)
Type
Cost
SvcCont (Y/N) if Y then ContNum link to Table2
ContNum
Table2: (Index: ContNum)
ContNum(PK)
Name
Phone
E-mail
BegDate
EndDate
Table2 Table1(Reference table)
ContNum 1<
>M ContNumAttachment is the database in MSAccess format.
Thanks for any help!
-
May 3, 2004 at 2:03 pm #15752CalEvansMember
Can you post the SQL that you are trying to execute to create the tables and relationships?
=C=
-
May 3, 2004 at 5:32 pm #15753dahuan60Member
No SQL have been to write to create table or set relationship. So, how I can attach this mysql database to you and get help. Also, I have a sql back up file but how to retrive it and show all tables in sqlyog???
-
May 3, 2004 at 5:52 pm #15754CalEvansMember
use SQLYog to export the tow tables (structure only) to a batch script. Then copy that and paste it in here. Don't try to attach it.
=C=
-
May 3, 2004 at 7:05 pm #15755dahuan60Member
Okay, here it is. Thanks a lot!
/*
SQLyog v3.7
Host – localhost : Database – fixed asset
**************************************************************
Server version 4.0.13-nt
*/
SET FOREIGN_KEY_CHECKS=0;
create database if not exists `fixed asset`;
use `fixed asset`;
/*
Table structure for core
*/
drop table if exists `core`;
CREATE TABLE `core` (
`TagID` varchar(6) NOT NULL default '',
`AssetType` char(1) default NULL,
`Categ` varchar(10) NOT NULL default '',
`Description` varchar(20) default NULL,
`Cost` decimal(8,0) default '0',
`AcqDate` date default NULL,
`Manufac` varchar(35) default NULL,
`ModelNo` varchar(10) default NULL,
`SerNo` varchar(20) default NULL,
`WrantyExp` date default NULL,
`CostrCr` varchar(4) default NULL,
`Vender` varchar(35) default NULL,
`ResponsibleName` varchar(40) default NULL,
`Bldg` char(2) default NULL,
`Wing` char(3) default NULL,
`Room` varchar(4) default NULL,
`SvcCtrt` char(1) default NULL,
`ContNum` varchar(8) default NULL,
PRIMARY KEY (`TagID`),
KEY `ContNum` (`ContNum`)
) TYPE=InnoDB;
/*
Table structure for svcontract
*/
drop table if exists `svcontract`;
CREATE TABLE `svcontract` (
`ContNum` varchar(8) NOT NULL default '',
`SVCVender` varchar(35) default NULL,
`BegDate` date default NULL,
`EndDate` date default NULL,
`ContName` varchar(40) default NULL,
`PhoneNum` varchar(19) default NULL,
`EMail` varchar(50) default NULL,
PRIMARY KEY (`ContNum`)
) TYPE=InnoDB;
SET FOREIGN_KEY_CHECKS=1;
-
-
AuthorPosts
- You must be logged in to reply to this topic.