create table 主表(
id1 int not null,
id2 int not null,
name varchar(10),
constraint PK_主表 primary key(id1,id2)
)
create table 从表(
id int identity(1,1) primary key,
a_id1 int not null,
a_id2 int not null,
word varchar(10),
constraint FK_从表_主表 foreign key(a_id1,a_id2)
references 主表(id1,id2) on update cascade on delete cascade)
go
id1 int not null,
id2 int not null,
name varchar(10),
constraint PK_主表 primary key(id1,id2)
)
create table 从表(
id int identity(1,1) primary key,
a_id1 int not null,
a_id2 int not null,
word varchar(10),
constraint FK_从表_主表 foreign key(a_id1,a_id2)
references 主表(id1,id2) on update cascade on delete cascade)
go