I have this SQL-script/sp
BEGIN TRAN
BEGIN TRY
INSERT INTO TblDest
SELECT * FROM TblSource
DELETE FROM TblSource
COMMIT TRAN
END TRY
BEGIN CATCH
ROLLBACK TRAN
END CATCH
It moves all rows in TblSource to TblDest. I want to make sure that any rows that is inserted while this backup is done stays in TblSource.
If I set a breakpoint before the DELETE-line and opens another window and inserts a new Row in TestSource, then complete the script, the new rows is being deleted.
Do I need a Temp-table or can I lock the entire table?