触发器(删除) Create trigger trdemployee On employee for Delete As Delete daily From daily br , Deleted d Where br.username=d.username
触发器(更新) Create Trigger truemployee On employee --在employee表中创建触发器 for Update --为什么事件触发 As --事件触发后所要做的事情 if Update(name) begin
Update daily Set name=i.name From daily br , Deleted d ,Inserted i --Deleted和Inserted临时表 Where br.username=d.username end
触发器(一表更新多表) Create Trigger trudept_type On dept_type --在employee表中创建触发器 for Update --为什么事件触发 As --事件触发后所要做的事情 if Update(type) begin Update daily Set dept=i.type From daily br , Deleted d ,Inserted i --Deleted和Inserted临时表 Where br.dept=d.type
Update employee Set dept=i.type From employee br , Deleted d ,Inserted i --Deleted和Inserted临时表 Where br.dept=d.type end
|