Can multiple instance of procedure create same #Temp simultaneously?

by RISHABH GOYAL   Last Updated May 03, 2018 05:06 AM

I have a procedure which is inserting data into #temp table. After performing certain manipulations to the data, it store data from #temp table to some other table.

I cannot run multiple instance of this procedure simultaneously. Why? We create #temp table with same name in multiple tabs, then why not multiple instances of temp table are able to do the same?

Is there any solution to it?

Example:

--exec dbo.testing_temp_table
CREATE PROCEDURE [dbo].[testing_temp_table]
AS
BEGIN

    SET NOCOUNT ON;

    -- Insert statements for procedure here
    IF OBJECT_ID('tempdb..#temp_1') IS NOT NULL drop table #temp_1
    select  * into #temp_1 from dbo.Emp

END


Related Questions


Statistics on temp tables

Updated May 18, 2017 17:06 PM