SQLServer 触发器 在一个表插入数据时,同时将数据插入另一个表

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[Loong_Ling]
   ON  [dbo].[bhyl_bankdtl_k3]
   AFTER INSERT
AS 
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for trigger here
	 INSERT INTO kui_wen(
        serial_id ,
		acc_name,
		abs,
		amt
    )
    SELECT
        i.serial_id,
		i.acc_name,
		i.abs,
		i.amt
      
    FROM
	inserted i
END

在将数据保存到bhyl_bankdtl_k3表时并将数据一同保存到  kui_wen 表

你可能感兴趣的:(SQLServer,触发器)