Home Forums SQL Server 7,2000 T-SQL Update field in INSERTED inside trigger RE: Update field in INSERTED inside trigger

  • I have an example

    create TRIGGER InsertarPeriodoForUpdate

    ON dbo.calificacion_IQA

    for update

    AS

    BEGIN

    SET NOCOUNT ON;

    declare @id int

    declare @mes int

    select @mes=mes_calificadcion, @id = id_calificacion_iqa from updated

    if @mes=1 or @mes = 2 or @mes = 3

    begin

    Update dbo.calificacion_IQA

    set cuarto = 1

    where id_calificacion_iqa=@id

    end

    if @mes=4 or @mes = 5 or @mes = 6

    begin

    Update dbo.calificacion_IQA

    set cuarto = 2

    where id_calificacion_iqa=@id

    end

    if @mes=7 or @mes = 8 or @mes = 9

    begin

    Update dbo.calificacion_IQA

    set cuarto = 3

    where id_calificacion_iqa=@id

    end

    if @mes=10 or @mes = 11 or @mes = 12

    begin

    Update dbo.calificacion_IQA

    set cuarto = 4

    where id_calificacion_iqa=@id

    end

    END

    GO