日期:2014-05-18 浏览次数:20731 次
--此处的pid,id就是联合主键
if object_id('pt2') is not null
drop table pt2
go
create table pt2(
pid int not null,
id int not null
)
go
alter table pt2 add constraint [PK_pt2] primary key(pid,id) on [PRIMARY]
go
------解决方案--------------------
设置两个字段叫联合主键
------解决方案--------------------
可以设置联合主键
primary key(col1,col2....)