Link 2 primary key between them

Posted on 2007-07-23
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
    LVL 15

    Expert Comment

    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).
    LVL 2

    Author Comment

    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
    >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

    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.
    LVL 2

    Author Comment

    ok, thank you guys :)


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
    Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

    761 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

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now