What is the difference between a Temporary Table and a Table Variable?
Mahanti Chiranjeevi
There is another good article on: 16 main differences between Temporary Table and Table Variable in Sql Server http://www.webcodeexpert.com/2015/02/difference-between-temporary-table-and.html
1. Temporary Tables are real tables so you can do things like CREATE INDEXes, etc. If you have large amounts of data for which accessing by index will be faster then temporary tables are a good option. 2. Table variables can have indexes by using PRIMARY KEY or UNIQUE constraints. (If you want a non-unique index just include the primary key column as the last column in the unique constraint. If you don't have a unique column, you can use an identity column.) 3. Table variables don't participate in transactions, logging or locking.
-Table variable is created in the memory where as a temporary table is created in the TempDB. -You can pass table variable as parameter to functions and stored procedures, where as you cannot do the same with temporary table.