DROP PROCEDURE Tmp_Cust_LimitInsProc
GO
CREATE PROCEDURE Tmp_Cust_LimitInsProc
(
	@CORRNBR        int,
	@SITEID		UD_IDSITE,
	@PORCENTLIMITED	UD_PORCENTAJE,
	@CREDLIMITED	UD_MONTO,
	@CURRBAL	UD_DEUDA,
	@PORCENTSURPLUS UD_PORCENTAJE,
	@MTOSURPLUS	UD_DEUDA
)
AS
BEGIN
    BEGIN TRAN

          INSERT INTO Tmp_Op_Cust_Limit(CORRNBR,SITEID,PORCENTLIMITED,CREDLIMITED,CURRBAL,PORCENTSURPLUS,MTOSURPLUS)
          VALUES(@CORRNBR,@SITEID,@PORCENTLIMITED,@CREDLIMITED,@CURRBAL,@PORCENTSURPLUS,@MTOSURPLUS)

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

    COMMIT TRAN

END


