Tuesday 29 August 2017

Maximum number of rows that can be stored in Temp table or a Table variable.

Temp Table:

No, there is no records limit for temporary table (the limit is the disk space). But be careful, because temporary tables are physically created in tempdb database, and this database must be placed on the disk with appropriate size.
The differences between tempdb and any other database are minimal, especially when it comes to limits. If you can store it in a user table, you can store it in a temporary table as well. It does not have to fit into RAM as the tempdb is stored on disk just like any other database (only with more aggressive caching and less logging).

Table Variable:

As such the official MSDN site where the Maximum Capacity Specifications for SQL Server there is no such upper limit defined for table variables because it depends on the database size and the free memory available for the storage. You can also refer the MSDN forum discussing the same; Maximum Capicity of Table Variable

No comments:

Post a Comment

GROUPBY VS PARTITIONBY