Please note, new blog at http://www.acheron.org/darryl/

SQL Server: Table variables vs. temporary tables

I just learned about table data types in SQL Server from some posts in the CFAUSSIE mailing list (via Scott Thornton). It looks like table data types are meant to replace temporary tables in SQL Server 2000, and have a very similar syntax. Temporary table CREATE TABLE #tmpTable(Col1 int, Col2 int) Table variable DECLARE @tmpTable TABLE(Col1 int, Col2 int) I did some searching, and one of the first results was this site. Interesting read, even though it was only the first part of a subscription only article. It turns out that table data types are slower than temporary tables for large sets of data, because SQL Server doesn't maintain statistics for queries on table variables.

By Anonymous Anonymous, at 8/31/2008 03:56:00 pm  

Visit for more details http://developmentzone.blogspot.com/2008/08/sql-server-temporary-tables.html



By Anonymous Anonymous, at 8/31/2008 03:57:00 pm  

Visit also http://developmentzone.blogspot.com/2008/08/temporary-tables-performance.html



» Post a Comment