标签:action auto div else 错误 select weight tran where
create trigger t1 on xs_kc for insert as print ‘有新成绩信息插入到xs_kc表中! ’ go insert xs_kc values( ‘2012130101‘, ‘111‘, 87, null )
use xscj insert xsqk values(‘2012140101‘, ‘陈希‘, 1, ‘1995-8-12‘, ‘环境艺术‘, ‘传媒‘) insert xsqk values(‘2012130110‘, ‘黄倩‘, 0, ‘1996-1-1‘, ‘信息安全‘, ‘计算机应用‘)
create trigger t3 on xsqk for delete as if(select 专业名 from deleted)=‘信息安全’ begin rollback transaction print ‘不能删除信息安全专业的学生信息!’ end else print ‘删除成功!’ go delete xsqk where 专业名= ‘信息安全’
create trigger t4 on xsqk for update as declare @old char(10), @new char(10) select @old=deleted.学号, @new=inserted.学号 from deleted, inserted where deleted.姓名=inserted.姓名 print ‘准备级联更新xs_kc表中的学号信息…‘ update xs_kc set 学号=@new where 学号=@old print ‘已经级联更新xs_kc表中原学号为‘+@old +‘的信息!‘
标签:action auto div else 错误 select weight tran where
原文地址:http://www.cnblogs.com/gaiyin/p/6879883.html