Table variable vs temp table in SQL Server 2008 -


possible duplicate:
what's difference between temp table , table variable in sql server?

what difference between table variable , temp table, have 2 question on it.

  • how decide when use what?
  • which 1 better in performance , why ?

the first difference transaction logs not recorded table variables. hence, out of scope of transaction mechanism, visible example:

create table #t (s varchar(128))  declare @t table (s varchar(128))  insert #t select 'old value #'  insert @t select 'old value @'  begin transaction       update #t set s='new value #'       update @t set s='new value @'  rollback transaction  select * #t  select * @t  

read more : http://www.sql-server-performance.com/articles/per/temp_tables_vs_variables_p1.aspx


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -