Tell me the difference between temporary table and table variable?
Which is better?

 Posted by Nishithraj on 1/5/2010 | Category: Sql Server Interview questions | Views: 2379

Better one is table variable.

In most of our real time scenario we are using the temp table which is physically created in tempdb. This creates overhead, but when you create a table Variable it only resides in the memory which clearly shows that it will be much faster than Temp table.
A table variable goes out of scope immediately after the batch end. If we use Table Variable then we no need to explicitly drop it.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response