Friday 17 February 2012

Difference between Temp Table and Table Variable in Sql

Biggest Difference between Temp Table and Table Variable are as follow:

As we studies they are include performance, Storage in memory and use tempdb to store etc..

Table variable are transaction neutral. And thus aren’t bound in transaction.


     Temp table behave as normal tables and are bound by transaction.
    
      A Simple Example are as follow:




We see that the table variable still exists and has all it's data unlike the temporary table that doesn't exists when the transaction rollbacked.

·    

No comments:

Post a Comment