Hi,
Thank you for the weekend response.
daelmo, I am using adapter. I have defined Partner as a subtype of Customer.
Otis, I'm sorry about the bad DDL (the OP is updated). I was playing with a new toy . I generally create the tables and FKs in seperate statements. The cycle works because the Customer.PartnerID is nullable.
Otis, I will try your renaming suggestion.
I have three cycle relationships in my data model. Is a third table the preferred way of cleaning up cycles? Something like this:
Create table [Customer]
(
[CustID] Integer Identity(10000,1) NOT NULL,
[AccountType] Nvarchar(20) NOT NULL,
Constraint [PK_Customer_CustID] Primary Key ([CustID])
)
go
Create table [Partner]
(
[PartnerID] Integer NOT NULL,
Constraint [PK_Partner_PartnerID] Primary Key ([PartnerID])
)
go
Create table [PartnerCustomer]
(
[CustID] Integer NOT NULL,
[PartnerID] Integer NOT NULL,
Constraint [PK_PartnerCustomer_CustID] Primary Key ([CustID])
)
go
Create table [AccountType]
(
[AccountType] Nvarchar(20) NOT NULL,
[Description] Nvarchar(100) NOT NULL,
[OrderBy] Integer NOT NULL,
Constraint [PK_AccountType_AccountType] Primary Key ([AccountType])
)
go
Alter table [Partner] add Constraint [FK_Customer_Partner_PartnerID] foreign key([PartnerID]) references [Customer] ([CustID]) on update no action on delete no action
go
Alter table [Customer] add Constraint [FK_AccountType_Customer_AccountType] foreign key([AccountType]) references [AccountType] ([AccountType]) on update no action on delete no action
go
Alter table [PartnerCustomer] add Constraint [FK_Partner_PartnerCustomer_PartnerID] foreign key([PartnerID]) references [Partner] ([PartnerID]) on update no action on delete no action
go
Alter table [PartnerCustomer] add Constraint [FK_Customer_PartnerCustomer_CustID] foreign key([CustID]) references [Customer] ([CustID]) on update no action on delete no action
go
(Bah, I forgot a table and had to edit the code after posting. )