Why do LocalTemp table showing with lengthy underscore under Temporary Tables of tempdb in SSMS 2017 Express Edition? [duplicate]

dba.stackexchange https://dba.stackexchange.com/questions/219136

Question

In my Microsoft SQL Server 2017 Express Edition, I have created a local temp table using below create statement,

create table #localtemptable
(tempid int,tempname varchar(20) )

After creating #table, I checked the tempdb -> Temporary Table , it is showing the table name along with a lengthy underscore and 0000000004 number. What is it meaning and why it is showing like this?

enter image description here

Was it helpful?

Solution

The lengthy underscore followed by the number were added by the engine to your requested table name in order to make the table name globally unique in the tempdb database. You can query your local table in the session that created it using the #localtemptable name that you gave it. What you are seeing is perfectly normal behavior and there's nothing to be alarmed about.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top