ALTER Trigger tr_sal On salaries
Instead of delete
AS
declare @id int
set @id=(select id_teacher from deleted)
if @id in (select ID_teacher from techers)
BEGIN
print 'not able !!'
END
ELSE
BEGIN
delete from salaries where [email protected]
END
delete from salaries
where id_teacher=???--(write id)
我想做的事:觸發「而不是刪除」,它可以工作嗎?
如果ID是老師,你不能刪除他/她的薪水,否則你可以刪除。
我運行此,讓兩個:
- 無法刪除無補貼!
- (1行(S)的影響)
是我的觸發工作或沒有?