DROP PROCEDURE TMP_OP_CCSALESPERSONDETDelProc
GO
CREATE PROCEDURE TMP_OP_CCSALESPERSONDETDelProc
(   @CORRNBR	    INT,
    @SITEID	    UD_IDSITE,
    @DATEPROCE      UD_FECHA,
    @SALESPERID     UD_SALESPERSONID,
    @CCSALESPERSONTYPEID	CHAR(2)
)

AS
BEGIN
    BEGIN TRAN

      		DELETE
      		FROM  	TMP_OP_CCSALESPERSONDET
      		WHERE 	CORRNBR=@CORRNBR AND SITEID=@SITEID AND DATEPROCE=@DATEPROCE AND SALESPERID=@SALESPERID AND
			CCSALESPERSONTYPEID=@CCSALESPERSONTYPEID 

    IF (@@error!=0 OR @@ROWCOUNT=0)
    BEGIN
        RAISERROR  20002 'Error al Eliminar en TMP_OP_CCSALESPERSONDET'
        ROLLBACK TRAN
        RETURN(1)
    
    END

    COMMIT TRAN

    RETURN(0)
END

