April 8, 2010 at 12:51 am
Do table variables log records in transaction log?
Contradicting informations in two articles:
http://www.sql-server-performance.com/articles/per/temp_tables_vs_variables_p1.aspx
http://www.mssqltips.com/tip.asp?tip=1556
What happens in case of a ROLLBACK.
John
April 8, 2010 at 1:01 am
In my experience, Table variable will not rollback.
A table variable's lifespan is only for the duration of the transaction that it runs in.
April 8, 2010 at 1:48 am
Table Variables are not bound to any transaction as they are just like any other variable.
Just like any other variable, a Table Variable's scope exists only within the context of the current level.
Unlike Temp Tables, it is not accessible to sub levels (of Stored Procedures)
If we execute the DECLARE statement first, then attempt to insert records into the '@Table_Variable' table variable we receive the error because the table variable has passed out of existence.
April 8, 2010 at 5:44 am
And, no... table variables are not logged. That's part of the reason why they aren't/can't be rolled back.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply