Total Page Preview:   000000013851

Difference between CTE(Common Table Expressions) and Table Variable in SQL Server

Difference between CTE(Common Table Expressions) and Table Variable in SQL Server :
  CTE Table Variable
1 CTE is like Derived Table or even like a sub-query. So it doesn't store on disk. Table variable is like Temporary Table. It stores on disk.
2 You cannot create any index on CTE You can create clustered index but can not create Non clustered index
3 Scope of CTE  is within the session Scope of table variable is within the batch
Difference Between CTE And Table Variable
 

Thank You

About Author

Brijesh Kumar

Database Developer

I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall and Database Migration On-Premise to Azure Cloud.
LinkedIn : https://www.linkedin.com



Comments


                           
                           

                           

                           

Facebook User: