While @@Fetch_Status = 0
Begin
INSERT INTO [server].MyDatabase.dbo.Mytabletobeinserted (
UPC,
Sale_date)
VALUES(
@UPC,
@Sale_date)
'Inserting the error trapping here'
IF (@@ERROR <> 0)
BEGIN
ROLLBACK TRANSACTION;
RETURN;
END
Update t_sale_from_pos
set been_sent = 'y'
where UPC = @UPC and sale_date=@sale_date
Fetch Next from CursorSale
into
@UPC,
@Sale_date
end
close CursorSale
deallocate CursorSale
This stored procedure runs every day with a scheduler and the data is being passed over the network. When this stored procedure executes and then along the process of execution there is a sudden network time out. This executes every row to send to the other server over the network.
Now, my problem is:
- How will this affect the data calling the rollback transaction inside the loop?
- Will it read all the lines again and send it to the server for insertion or it will just read the row where it fails during the execution?
Need some advice. Thanks