Check out this deepdive on table variables that I found the other day:
The article deals with some common misconceptions about table variables and it’s considerably more in-depth than my post on different types of temp tables.
As of SQL Server 2008, you can create user-defined datatypes as tables, which comes in pretty handy when you want to pass an entire table as an argument to a stored procedure or a function. And as a bonus, you get get really pretty, highly readable code!
You may not know that there are two different ways of writing user-defined functions that return a recordset: Table value functions and Inline functions, and they both come with a number of benefits and limitations with regard to performance and programmability.