Solved

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

Posted on 2008-06-12
2
205 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
[X]
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
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

734 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