Total Page Preview:   000000009421

What is Table Variable? Explain its advantages and disadvantages?

  • If we want to store tabular data in the form of rows and columns into a variable then we use a table variable.
  • It is able to store and display 2D data (rows and columns).
  • We cannot perform DDL (CREATE, ALTER, DROP).
 
Advantages:
  • Table variables can be faster than permanent tables.
  • Table variables need less locking and logging resources.
 
Disadvantages:
  • Scope of Table variables is batch bound.
  • Table variables cannot have constraints.
  • Table variables cannot have indexes.
  • Table variables do not generate statistics.
  • Cannot ALTER once declared (Again, no DDL statements).

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: