SQL Server, temporary tables with truncate vs table variable with delete

Posted by Richard on Stack Overflow See other posts from Stack Overflow or by Richard
Published on 2010-04-15T15:32:50Z Indexed on 2010/04/15 15:43 UTC
Read the original article Hit count: 524

I have a stored procedure inside which I create a temporary table that typically contains between 1 and 10 rows. This table is truncated and filled many times during the stored procedure. It is truncated as this is faster than delete. Do I get any performance increase by replacing this temporary table with a table variable when I suffer a penalty for using delete (truncate does not work on table variables)

Whilst table variables are mainly in memory and are generally faster than temp tables do I loose any benefit by having to delete rather than truncate?

© Stack Overflow or respective owner

Related posts about sqlserver2005

Related posts about temporary-tables