Table Variables are not Transactional, that is to say BEGIN TRAN....ROLLBACK has no effect on them; we can use that to our advantage.
Have you ever been in the situation where you use a log file within your application to log progress, unfortunetly because your process is in a transaction you lose what has happened, well - not anymore - just use a table variable....
create table my_log_file (
msg varchar(1024)
)
declare @t table ( msg varchar(1024) )
begin tran
-- some processing
-- ...
-- ...
-- logging as we go....
insert my_log_file ( msg ) values( '1' )
insert my_log_file ( msg ) values( '2' )
insert my_log_file ( msg ) values( '3' )
insert my_log_file ( msg ) values( '4' )
insert @t ( msg ) select msg from my_log_file
rollback
select * from my_log_file
select * from @t