日期:2014-05-17  浏览次数:20456 次

建立触发器问题!
检查订单表,如果删除的雇员没有接受订单,可以删除该雇员信息,否则撤消删除,显示“不能删除该雇员!”信息。

create trigger tri_employee_del
on Employee
after delete
as
declare @var_雇员ID int
if exists(select * from P_order where 雇员ID=@var_雇员ID)
delete from Employee where 雇员ID=@var_雇员ID
else
print(不能删除该雇员!)
rollback
go
delete Employee
where 雇员ID=7
go

请问哪里出错了!!!