IF OBJECT_ID('dbo.sp_fco_upd_sit_periodo') IS NOT NULL
    DROP PROCEDURE dbo.sp_fco_upd_sit_periodo
GO
CREATE PROCEDURE dbo.sp_fco_upd_sit_periodo
(
    @pch_compania char(4),
    @pch_periodo char(7),
    @pch_operacion char(7)
)
AS
BEGIN    
    UPDATE fco_integrada_cab
    SET sit_periodo = CASE WHEN Upper(@pch_operacion) = 'FCO3060' THEN 2 ELSE 1 END
    WHERE compania = @pch_compania
      AND anio = Left(@pch_periodo, 4)
      AND mes = Right(@pch_periodo, 2)
END
GO
GRANT EXECUTE ON dbo.sp_fco_upd_sit_periodo TO PUBLIC
GO

