Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Global temporary tables are dropped when the session that created them ends, and all other tasks has stopped using them.BOL said:A local temporary table created in a stored procedure is dropped automatically when the stored procedure completes. The table can be referenced by any nested stored procedures executed by the stored procedure that created the table. The table cannot be referenced by the process which called the stored procedure that created the table.
To use a temp table to get data in and out of a stored proc you have to create the table out side of the proc.Global temporary tables are automatically dropped when the session that created the table ends and all other tasks have stopped referencing them. The association between a task and a table is maintained only for the life of a single Transact-SQL statement. This means that a global temporary table is dropped at the completion of the last Transact-SQL statement that was actively referencing the table when the creating session ended.
create procedure spTest as
insert into #Test
(val)
values
(1)
go
create table #Test
(val int)
exec spTest
select * from #Test