DROP PROC op_borrartransgrabadas
GO
CREATE PROC op_borrartransgrabadas
@CORRNBR integer
as

begin tran

delete tmp_op_salesdetcstore where CORRNBR=@CORRNBR
delete tmp_op_salescstore where CORRNBR=@CORRNBR

 IF (@@error!=0)
    BEGIN
        RAISERROR  20000 'op_borrartransgrabadas Error al Borrar Transaccion'
        ROLLBACK TRAN
        RETURN(1)    
    END
    COMMIT TRAN   
go

exec op_borrartransgrabadas 273

select * from tmp_op_salescstore
select * from tmp_op_salesdetcstore
