Solved

Temp table max size

Posted on 2013-12-15
3
830 Views
Last Modified: 2013-12-23
Hello Experts,

I would like to get some insight about the temp tables in sql server. I am using sql server 2012. I have a temp table with 120 columns, I was wondering how many columns a temp table can handle and what is the limit of number of records that can be stored in the temp table.

Thanks in advance!!
0
Comment
Question by:ravichand-sql
3 Comments
 
LVL 9

Assisted Solution

by:guswebb
guswebb earned 250 total points
ID: 39720172
Temp tables are created in the tempdb database so actually exist on disk like any other user table. SQL Server limitations can be seen here http://msdn.microsoft.com/en-us/library/ms143432.aspx

You are most likely to run out of disk space before you hit any of these limits I would expect.

Columns = 30,000 for wide table, or 1,024 for non wide table.
Rows = limited only by your disk space.
0
 
LVL 65

Accepted Solution

by:
Jim Horn earned 250 total points
ID: 39720174
The differences between tempdb and any other database are minimal, especially when it comes to limits, so that applies to #tmp tables vs. physical tables.   So, #tmp tables are only limited by disk space, and SQL Server limitations. of 1024 columns and rows only limited by disk space.

What might be a more appropriate conversation is why would you want to take a set that is 120 column x however many rows, and make it a temp table vs. a physical table?
0
 
LVL 11

Expert Comment

by:John_Vidmar
ID: 39721507
Your data-page-size limits the size of each record contained in your table configuration.  Example, if you have a 4k data-page then the sum of the fixed-length columns may not exceed that limit (of course, there is data-page overhead, so you will not get exactly 4096 bytes for data).  So, in your example, 120 columns is achievable if you don't have many big char fields.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question