I have a local temporary table like this:
create table #tbl
(
employeeId int,
employeeName nvarchar(50)
)
insert into #tbl
values (1, 'a'), (2, 'b'),
(3, 'c'), (4, 'd')
select * from #tbl
Now I can access the local temporary table in that particular user session and in that particular query window compared to the global temporary table in which I can access the global temp table in any of the query window until the created query window gets closed, so far so good.
Now I am not able to understand the reason why one would require a global temporary table.
My questions are:
Is global temporary table instance specific? If yes then how can other user get hold of the newly created global temporary table
What is the reason SQL Server developed global temporary table over local temporary table?