Problem with Foreign key & Primary key in three tables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ShirishKumar
    New Member
    • Mar 2008
    • 7

    Problem with Foreign key & Primary key in three tables

    I have three tables

    1) Country - columns (PKCountryId(Pr imaryKey),Count ryName)

    2)State - Columns (PKStateId(Prim aryKey),StateNa me,FKCountryId( ForeignKey))

    3)Address Details -Columns(PKAddre ssId(PrimaryKey ),......,...... .,FKCountryId(F oreignKey),FKSt ateId(ForeignKe y),............ ......)

    I developed relationship like this. I have three relations

    1)FK_AddressDet ails_Country(Be tween Country table and AddressDetails table of PKCountryId in Country Table and FKCountryId in AddressDetails in AddressDetails Table)
    2) FK_AddressDetai ls_State (Between State table and AddressDetails table of PKStateId in State Table and FKStateId in AddressDetails in AddressDetails Table)
    3)FK_State_Coun try(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 ............... ......in the dialog box displaying
    - Unable to create relationship 'FK_AddressDeta ils_Country'.
    Introducing FOREIGN KEY constraint 'FK_AddressDeta ils_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,
    Shirish......
Working...