Compound primary key in Table type variable

前端 未结 1 982
無奈伤痛
無奈伤痛 2020-12-29 01:36

SQL Server 2008:

DECLARE @MyTable TABLE(
    PersonID INT NOT NULL,
    Person2ID INT NOT NULL,
    Description NVARCHAR(100),
CONSTRAINT PK PRIMARY KEY CLUS         


        
相关标签:
1条回答
  • 2020-12-29 02:15

    You can define a composite primary key like this:

    DECLARE @MyTable TABLE
    (   
        PersonID INT NOT NULL,    
        Person2ID INT NOT NULL,    
        Description NVARCHAR(100),
        PRIMARY KEY (PersonID, Person2ID)
    );
    
    0 讨论(0)
提交回复
热议问题