Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2005
    Posts
    25

    Unanswered: Referencing composite Primary KEYS

    Hi,
    i want to make a reference from a table on itself.
    The table has a composite Primary Key. But I just want to refernce the TEstCaseID.
    So whats wrong? Can anyone help me?


    CREATE TABLE dbo.TestCase (
    Project_projectID VARCHAR(20) NOT NULL references Project,
    testCaseID VARCHAR(50) NOT NULL,
    PRIMARY KEY(Project_projectID, testCaseID),
    FatherID VARCHAR(50) references TestCase(testCaseID)

    )


    THanx Crean

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    For logical reasons, you can only reference unique values. Otherwise, how would SQL Server (or any database engine) know which of many records you were referencing?
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Nov 2005
    Posts
    25
    Already found out. But thanx a lot

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •