PDA

View Full Version : Compare Table Variables with Temporary Tables in Database?



sindhusmile
12-06-2018, 07:54 PM
Found many mini and major articles online comparing Tables variables with Temporary Tables in MySQL. Most of them are very complex with huge list of content like scope, usage, creation, table name, column data types, collation, indexes, constraints, post creation DDL, data insertion, Insert explicit values into identity columns (SET IDENTITY_INSERT), Truncate table, destruction, Stored procedure recompilations, transactions, rollbacks, statistics, Pass to stored procedures, dynamic sql and Explicitly named objects (indexes, constraints). Can you explain any one of this in lucid manner with a real example?

guruamit
12-26-2018, 06:32 AM
Temp Tables are physically created in the Tempdb database. These tables act as the normal table and also can have constraints, index like normal tables. CTE is a named temporary result set which is used to manipulate the complex sub-queries data.