Thursday, October 31, 2013

Local temporary table vs table variable - SQL Server 2008 R2/2012


Hi,


looking inside an old stored procedure I've seen the definition of a local temporary table as SELECT ... INTO #tmptable.


In this case, and more in general, could it be better to use a table variable, also the performance of the stored procedure?


Thanks



There is not enough information about "this case" to answer your question. Temporary tables and table variables each have their own advantages and disadvantages.


It depends.


So I wouldn't change it unless you have a good reason for the change.




Gert-Jan


No comments:

Post a Comment