Better one is table variable.
In most of our real time scenario we are using the temp table which is physically created in tempdb. This creates overhead, but when you create a table Variable it only resides in the memory which clearly shows that it will be much faster than Temp table.
A table variable goes out of scope immediately after the batch end. If we use Table Variable then we no need to explicitly drop it.
Asked In: Many Interviews |