DROP PROCEDURE Tmp_Cust_LimitUpdProc
GO
CREATE PROCEDURE Tmp_Cust_LimitUpdProc
(
	@CORRNBR        int,
	@SITEID		UD_IDSITE,
	@PORCENTLIMITED	UD_PORCENTAJE,
	@CREDLIMITED	UD_MONTO,
	@PORCENTSURPLUS UD_PORCENTAJE,
	@MTOSURPLUS	UD_DEUDA

)
AS
BEGIN
    BEGIN TRAN
 	  UPDATE Tmp_Op_Cust_Limit
	  SET 	PORCENTLIMITED=@PORCENTLIMITED,
		CREDLIMITED=@CREDLIMITED,
		PORCENTSURPLUS=@PORCENTSURPLUS,
		MTOSURPLUS=@MTOSURPLUS
          WHERE CORRNBR=@CORRNBR AND SITEID=@SITEID

    IF (@@error!=0)
    BEGIN
        RAISERROR  20000 'Error Actualizando en TMP_OP_CUST_LIMIT'
        ROLLBACK TRAN
        RETURN(1)
    
    END

    COMMIT TRAN

END