触发器
--新增Customer表后执行下面触发器tgr_Customer_Insert
create trigger tgr_Customer_Insert
on Customer
after insert
as
begin
declare @cCusCode varchar(20)
select @cCusCode=cCusCode from inserted--获取insert后的客户编码
update Customer set cCusSAProtocol=cCusDefine2,cCusRegCode=cCusDefine1 where cCusCode=@cCusCode
end
--删除student表某一条数据后执行下面触发器 select * from deleted 当前删除的表记录信息(字段跟原表一样)
create trigger trig_student_delete on student after delete as begin select stu_id as 已删除的学生编号,stu_name stu_gender,stu_age from deleted end;
---------------------------------查询触发器------------------------------------------------------------
SELECT * FROM SYSOBJECTS WHERE XTYPE='TR' AND parent_obj = OBJECT_ID('Customer') 查询Customer表所有触发器
-----------------------修改触发器---------------------------------
alter trigger tgr_Customer_Insert
on Customer
after insert
as
begin
declare @cCusCode varchar(20)
select @cCusCode=cCusCode from inserted--获取insert后的客户编码
update Customer set cCusSAProtocol=cCusDefine2,cCusRegCode=cCusDefine1 where cCusCode=@cCusCode
end
------------恢复内容结束------------
玉环人才吧
玉环人才网
玉环人力网
玉环招聘网
三支脚人才网
玉环人力网(又名玉环人才网)是玉环人才吧旗下一流的玉环人力资源招聘行业服务品牌,汇集海量玉环人才,开放玉环人才简历和玉环岗位,提供玉环招聘网,玉环人才市场动态行情,玉环劳务派遣,玉环培训等,是玉环最大的人才网站。