Gaining DKP through Roster Addition

CREATE TRIGGER [dbo].[tss_Rosters_INSERT]
   ON [dbo].[tss_Rosters]
   FOR INSERT
AS
BEGIN

    SET NOCOUNT ON;

    IF NOT EXISTS (SELECT * FROM inserted)
        RETURN;

    /*
       When a Roster is added, credit the RaidValue to the Player.
    */

    UPDATE tss_Players
    SET tss_Players.EarnedDKP = tss_Players.EarnedDKP + tss_Raids.RaidValue,
        tss_Players.SavedDKP = tss_Players.SavedDKP + tss_Raids.RaidValue
    FROM inserted
        INNER JOIN tss_Raids ON inserted.RaidID = tss_Raids.RaidID
    WHERE (tss_Players.PlayerID = inserted.PlayerID);

END

Last edited Feb 6, 2008 at 10:21 PM by Salaza, version 1

Comments

No comments yet.