Learn how to a build a cloud-first strategyRegister Now


Link 2 primary key between them

Posted on 2007-07-23
Medium Priority
Last Modified: 2008-03-04
Hi experts,

i just want to know if it is a good thing to do such a thing :

i have a primary key in table A and a primary key in table B

i linked primary key A to primary key B

because bot column have same value and have to be unique

thank you in advance.

Question by:Dnx_7
  • 2
  • 2
LVL 15

Expert Comment

ID: 19547409
If both columns are the same/unique, then you should probably combine table A/table B into 1 table. Stick all of the columns (minus the PK) from table B into table A (or vice versa).

Author Comment

ID: 19547449
no i can't modify the structure of table A
because table B is a new table with a "higher" level to achieve new task
table A cannot be modify...

that's why we tried this solution, in management studio, we save the primary key of table A as a foreign key of primary key of table B
and there is no error... and we did some test with success... and we tought that it was the good idea

that's why i'm here to have suggestion of experts

LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 80 total points
ID: 19547483
>i just want to know if it is a good thing to do such a thing :
this depends. for example if tableA is a master table something like an employee table and tableB is something like a sal table , then you can create a foreign key relationships
LVL 15

Accepted Solution

derekkromm earned 120 total points
ID: 19547491
It will work just fine. Its simply not the best design because its redundant (i.e. not normalized). But technically speaking, it will work fine.

Author Comment

ID: 19547510
ok, thank you guys :)


Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Suggested Courses

810 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