Difference between Table Variable (@tbl) and temporary table (#temp or ##temp

 Posted by Puneet20884 on 3/23/2010 | Category: Sql Server Interview questions | Views: 5108

1. Transaction logs are not recorded for the table variables.

2. A procedure having temporary table is not pre-compiled, while an execution plan of procedures with table variables can be statically compiled in advance.

3. Table variables exist only in the same scope as variables.
Differencing to the temporary tables, they are not visible in inner stored procedures and in exec(string) statements. Also, they cannot be used in an insert/exec statement.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response