update 触发器(当update表中某个字段时,实施其他操作)

update 触发器(当update表中某个字段时,执行其他操作)
-- ================================================
-- Template generated from Template Explorer using:
-- Create Trigger (New Menu).SQL
--
-- Use the Specify Values for Template Parameters 
-- command (Ctrl-Shift-M) to fill in the parameter 
-- values below.
--
-- See additional Create Trigger templates for more
-- examples of different Trigger statements.
--
-- This block of comments will not be included in
-- the definition of the function.
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
alter TRIGGER maininfor_update on T_BOOK_MAININFOR
   FOR update 
AS 
if update(housesit) and @@rowcount=1
BEGIN 
	update fe_app1026..T_FEE SET FWZL=Inserted.housesit 
		from FE_APP1026..T_FEE inner join inserted on FE_APP1026..T_FEE.ywzh=Inserted.ywzh

	if @@error<>0   rollback transaction
SET NOCOUNT ON;

END
GO