-- run this script in session-1
CREATE TABLE ##GLOBAL_temp_table
(
COL1 INT,
COL2 VARCHAR(30),
COL3 DATETIME DEFAULT GETDATE()
)
GO
select * from ##GLOBAL_temp_table
Run same script in another session ( session2) by opening 'New Quey' editor using SSMS. It will thow below error
/* Msg 2714, Level 16, State 6, Line 1
There is already an object named '##TEMP_GLOBAL' in the database.
*/
The reason behind this is that global temp table is accessible to all sessions ( i.e. it is specific to instance, but not the session).
If you wanted to create session-specific temporary table, go ahead with local temp tables (for example, #TempTable ).