I learned about this from Pinal Dave's blog(You can see the original article in references.)
In SQL Server, while creating a table, we can give maximum length of 128 characters. However, while creating temp tables, maximum length can be of 116 characters only.
SQL Server allows you to create temp tables with same names in different sessions. While creating temp tables, table names will be padded up with 12-byte magic string. This padding is to differentiate the table names that are created between different sessions. So, this padding takes up 12-bytes. Because of this, temp tables can have maximum of 116 characters only as their name.
Published under: SQL Server Tips · · · ·