最近做了个触发器的例子
CREATE TRIGGER tru_User
ON _User for update
AS
if Update(status)
begin
update _user set stopflag=1 from Inserted where _user.userid=Inserted.userid and Inserted.status='A'
update _user set stopflag=0 from Inserted where _user.userid=Inserted.userid and Inserted.status='S'
update _user set stopflag=2 from Inserted where _user.userid=Inserted.userid and Inserted.status='D'
end
GO
CREATE TRIGGER tru_Pat_Dict_Patrol_Place
ON Pat_Dict_Patrol_Place for update
AS
begin
update Pat_Dict_Patrol_Place set updatetime=getdate() from Inserted where Pat_Dict_Patrol_Place.PatPlaceID=Inserted.PatPlaceID
end
GO
CREATE TRIGGER tru_Pat_Dict_PatrolPlace_Facility_Relation
ON Pat_Dict_PatrolPlace_Facility_Relation for update
AS
begin
update Pat_Dict_PatrolPlace_Facility_Relation set updatetime=getdate() from Inserted where Pat_Dict_PatrolPlace_Facility_Relation.PatPlaceID=Inserted.PatPlaceID
end
GO
1465

被折叠的 条评论
为什么被折叠?



