Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Cannot create a relationship between two specific tables in a database as error message occurs

Posted on 2008-06-12
2
202 Views
Last Modified: 2011-10-19
Cannot create a relationship between two specific tables in a database as error message occurs.

I need to create a cascading relationship between two tables, users and addressDetails.

However, an error occurs (file is attached) and wont let me create the relationship, even if i remove the cascading delete.
Any clues?
All other tables with similar links do work.

Thanks Julia
MembershipSchema.txt
0
Comment
Question by:Juliafrazer
2 Comments
 
LVL 60

Assisted Solution

by:chapmandew
chapmandew earned 100 total points
ID: 21768581
The only way you're going to be able to create your unique constraint is for you to remove the duplicates from the table for the column you're trying to create the constraint on.
0
 
LVL 1

Accepted Solution

by:
Bernard_Jakopovic earned 400 total points
ID: 21768670
combination of PK columns in addressDetails produces duplicate key. try to build PK on addressDetails separately, finding out what rows are producing this error. You can do that with query like:

select PKcolumn1, PKcolumn2.. from addressDetails group by  PKcolumn1, PKcolumn2 having count(*)>1

this will list all duplicate keys.
(PKcolumn1, PKcolumn2.. are all columns you use for PK in addressDetails table)
you will probably have to extend PK to more columns, or remove duplicate data.

This, however, doesnt affect building the relationship exept if Users is FK table (you are puting relation on addressDetails in users table) and this is a wrong approach in modeling. You must put FK to users in addressDetails. So, you evidently have two problems to solve :)
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question