<div class="codetitle"><a style="CURSOR: pointer" data="16038" class="copybut" id="copybut16038" onclick="doCopy('code16038')"> 代码如下:<div class="codebody" id="code16038"> create trigger TR_MasterTable_Update on MasterTable after update as if update ([Type])--当Type字段被更新时,才会触发此触发器 insert into MasterLogTable select Id ,(Case [Type] when 1 then 'Type1' when 2 then 'Type2' when 3 then 'Type3' when 4 then 'Type4' else 'TypeDefault' end) ,Name from inserted go 另外再补充一句:insert和update的数据都会保存在临时表中,所以使用inserted可以取出这些数据,删除时使用deleted可以取出被删除的数据 转载请标明出处:http://blog.csdn.net/tjvictor (编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|