联合主键建立方法

create table Cart
(
   [UserID] uniqueidentifier not null,
   [ProductID] int not null,
   [ProductName] varchar(80) not null,
   [Price] [decimal](10, 2) NOT NULL,
   [ImagePath] [varchar](100) NULL,
   Quantity int not null,
   IsAnonymous bit not null
)

alter table Cart
add constraint [PK_Cart] primary key CLUSTERED([USerID],[ProductID]) on [Primary]

posted @ 2012-05-06 14:03  Bug山Bug海  阅读(187)  评论(0)    收藏  举报