USE [RF_WORLD]
GO
/****** Object: Trigger [dbo].[lastdeathtrigg] Script Date: 08/20/2012 10:52:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Mauro Tamm
-- =============================================
ALTER TRIGGER [dbo].[lastdeathtrigg]
ON [dbo].[tbl_pvporderview]
AFTER UPDATE
AS
IF (UPDATE(Death))
BEGIN
SET NOCOUNT ON;
DECLARE @userserial int;
SELECT @userserial ='serial' WHERE UPDATE(Death)
Insert INTO [RF_WORLD].[dbo].[lastdeath]
(serial)
VALUES (@userserial)
END
where 部分是可疑的,它会这样工作吗?本质上,如果它实际更新,我需要它只选择行序列值。
触发器有几个问题:
inserted
和/或deleted
伪表。UPDATE()
只会告诉您该列已被引用,但不会告诉您该值是否已更改。以下是我将如何重写您的触发器: