Domanda

I know #temp is temp. Table valid for particular session only. but if i define #temp in two different session, and run them simultaneously will that conflict. if no then how actually these tables are stored in memory. And how is that different from ##Temp?????

È stato utile?

Soluzione 2

From CREATE TABLE

The full name of a temporary table as stored in the sysobjects table in tempdb is made up of the table name specified in the CREATE TABLE statement and the system-generated numeric suffix.

So it is stored in the tempdb.

Also from Temporary Tables in SQL Server

Temporary tables and table variables are created in the TempDB database

Altri suggerimenti

Temporary tables with a single # are "local", while those with a double ## are "global".

Local ones will drop out of scope once the stored procedure that defines them is done.

Global ones can be used by other users, or by the same user from different stored procedures, or by multiple calls of the same procedure. They will get dropped only after the last user that was referencing them is no longer referencing them, i.e. after the last stored proc is complete.

All are stored in the tempdb database; none in the "memory".

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top