By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,619 Members | 1,158 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,619 IT Pros & Developers. It's quick & easy.

Problem with Foreign key & Primary key in three tables

P: 7
I have three tables

1) Country - columns (PKCountryId(PrimaryKey),CountryName)

2)State - Columns (PKStateId(PrimaryKey),StateName,FKCountryId(Forei gnKey))

3)Address Details -Columns(PKAddressId(PrimaryKey),......,.......,FKC ountryId(ForeignKey),FKStateId(ForeignKey),....... ...........)

I developed relationship like this. I have three relations

1)FK_AddressDetails_Country(Between Country table and AddressDetails table of PKCountryId in Country Table and FKCountryId in AddressDetails in AddressDetails Table)
2) FK_AddressDetails_State (Between State table and AddressDetails table of PKStateId in State Table and FKStateId in AddressDetails in AddressDetails Table)
3)FK_State_Country(Between State Table and Country Table of PKCountryId in Country Table and FKCountryId in State Table)

I have the requirement like this...when i delete a country from countrytable it has to delete in state table and AddressDetails table...I not able to develop the relation ship when i do using Database Diagrams with Insert and delete specification as DeleteRule Set to Cascade ....i am getting this error with UpdateRule set to NoAction

This is the error the dialog box displaying
- Unable to create relationship 'FK_AddressDetails_Country'.
Introducing FOREIGN KEY constraint 'FK_AddressDetails_Country' on table 'AddressDetails' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.
Could not create constraint. See previous errors.

This is important for me

Post your answers quickly

Thanking You,
Mar 21 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.