• Nice article covering some basic points, but here are 2 important points to hightlight:

    A lot of my work day-to-day is fining previously written procedures that are slow and re-writing them more to be more efficient.  I often end up converting all the table variables to temp tables and making indexes on the columns that are used in JOINs or WHERE or GROUP BY clauses in subsequent queries.  This is especially germane when the row sizes are large.  When I bench mark and compare the two methods, I'd say that 75% of the time the #temp tables are considerable faster especially when number of rows are great (100,000 or higher)

    However, in the case of user-defined functions you have no choice but to use a table variable.

    - Paul

    - Paul

    http://paulpaivasql.blogspot.com/