ScottPletcher (5/5/2014)
I would never use a table variable for this -- if something goes wrong after the DELETEs, but before the output has been processed, the data is gone, with no way to get it back.Do you have a separate db that you use for export / other utility purposes? If not, you may want to create one. Output the rows to be deleted to a table, then delete the rows.
Process that other table within a transaction, so that the rows must be successfully exported before the export table has its rows deleted.
I agree, the table variables are for the sake of providing a sample schema for the demonstration of the functionality, should have been more clear on that!
😎