SQL Select WHERE row updated 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


The where part is suspicious, woudl it work like that? essentially i need it to only select the row serial value if it actually updated.
Several problems with your trigger:


You are assuming the trigger fires per row, whereas triggers fire per statement. This means you can't just assign a variable because this won't work if the update affects more than one row.
Your query to assign a variable doesn't pull from anywhere - you need to reference the inserted and/or deleted pseudo-tables.
Checking UPDATE() only tells you that the column was referenced, but it doesn't tell you whether the value has changed.


Here is how I would re-write your trigger:

-- this assumes Death is not nullable

ALTER TRIGGER [dbo].[lastdeathtrigg]
   ON  [dbo].[tbl_pvporderview]
   AFTER UPDATE
AS 
IF (UPDATE(Death))
BEGIN
  SET NOCOUNT ON;

  INSERT RF_WORLD.dbo.lastdeath(serial)
    SELECT i.serial FROM inserted AS i
    INNER JOIN deleted AS d
    ON i.serial = d.serial 
    AND i.Death &lt;&gt; d.Death;
END
GO