Results 1 to 2 of 2

Thread: Multicolumn primary key in a table variable

  1. #1
    Join Date
    Jan 2005
    Location
    Prague, Czech Republic
    Posts
    29

    Multicolumn primary key in a table variable

    Is it possible? And if yes what's the correct syntax?

    I tried both

    Code:
      Declare @expired TABLE (
        JdtID Int PRIMARY KEY,
        SiteID Int PRIMARY KEY,
        PackageId Int,
        PackageControlsExpiration Bit,
        IsSlot Bit,
        MembershipPoints SmallInt,
        SupportsAutopost Bit
      );
    and

    Code:
      Declare @expired TABLE (
        JdtID Int,
        SiteID Int,
        PackageId Int,
        PackageControlsExpiration Bit,
        IsSlot Bit,
        MembershipPoints SmallInt,
        SupportsAutopost Bit,
        CONSTRAINT Expired_PK PRIMARY KEY (JdtId, SiteId)
      );
    and neither works.

    Thanks, Jenda

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    Declare @expired TABLE (
    JdtID Int,
    SiteID Int,
    PackageId Int,
    PackageControlsExpiration Bit,
    IsSlot Bit,
    MembershipPoints SmallInt,
    SupportsAutopost Bit
    PRIMARY KEY (JdtId, SiteId)
    )

Posting Permissions

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