I have something like this:
我有这样的东西:
create table account
(
id int identity(1,1) primary key,
usertype char(1) check(usertype in ('a', 'b')) not null,
unique(id, usertype)
)
create table auser
(
id int primary key,
usertype char(1) check(usertype = 'a') not null,
foreign key (id, usertype) references account(id, usertype)
)
create table buser
(
... same just with b
)
cr