if(object_id('tri_up_c','tr') is not null)
drop trigger tri_up_c
go
create trigger tri_up_c
on C
for insert
as
if(exists(select * from
(select count(SNO) as num from CT ct join C c on c.CNO=ct.CNO) t where t.num>c.NUMBER))
raiserror('人数超过无法选课',16,11);
go
你先试试行不行,不行再问我
追问from CT ct 小写的是引用么?
追答是给表起的别名! 中间省略了as