473,385 Members | 1,869 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problem with Foreign key & Primary key in three tables

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 .....................in 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,
Shirish......
Mar 21 '08 #1
0 1308

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

Similar topics

7
by: middletree | last post by:
Posted this to Access group, meant to do it here: I have what I call a composite table. Can't recall what they called it in database class, but it's where you take the PK of two different...
2
by: Kamlesh | last post by:
Hi, I am using SQL Server 7.0 TABLE1 ====== Fld1 Fld2 Fld3
31
by: Robert Brown | last post by:
Let's say I have a type hierarchy: (just an example) the general entity customer: CREATE TABLE customer(customer_id int, customer_name varchar(250), customer_type int) three specific...
3
by: Megan | last post by:
hi everybody- i'm having a counting problem i hope you guys and gals could give me some help with. i have a query that retrieves a bevy of information from several different tables. first let...
2
by: DataB | last post by:
Hi everyone! I have a forms problem. Bakground: I have created a number of tables. Of these, I have a main parent table (Personal Details) and a number of other child tables (Tax file No.,...
9
by: Jax | last post by:
I'm making my first ever database for my program. I understand the concept of one to many relationships but fail to see the advantage of using a secondary key over a primary one. I have a lot of...
14
by: Lars Netzel | last post by:
A little background: I use three Datagrids that are in a child parent relation. I Use Negative Autoincrement on the the DataTables and that's workning nice. My problem is when I Update these...
4
by: booker | last post by:
Hello, I have a problem with foreign key. What I want to do is , have one foreign key referencing in two different tables! I have created three tables: create table University( ...
5
by: RomeoX | last post by:
Hi everybody actually I need your help in fixing my code. Actually I have a library system that can be applied in university or any school and I'm stucking in a page that for loan student book. I...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.