title: There is already an object named ##Temp2 in the database
body: <p>I have a global Temporary table and I intend to have so as I want multiple connections to be able to access it. </p>
  
  <p>I am using something kind of SQL server agents to employ parallelism and so multiple connections are established while the script is executing. </p>
  
  <p>I have a procedure called <code>dbo.Outputprocedure</code> where the execution starts and ends. Multiple procedures are called from here which are executed in different connections. </p>
  
  <p>Now , my problem is that I delete <code>##Temp2</code> table both at starting of <code>dbo.Output Procedure</code> and at the end.
  However, it does not look like it gets deleted. </p>
  
  <p>Here is the query that I use to delete <code>##Temp2</code> before I create.</p>
  
  <pre><code>IF OBJECT_ID('tempdb..dbo.##Temp2') Is not null
  Begin
  drop table ##Temp2
  End
  
  IF OBJECT_ID('tempdb..dbo.##Temp2') Is null
  Begin
  create table ##Temp2
  (
  Rownumber int not null,
  --ValFromUser nvarchar(30),
  --ColumnName nvarchar(30),
  --ValFromFunc decimal(18, 4),
  --FuncWeight decimal(18, 4),
  Percentage decimal(18, 4) not null,
  
  );
  
    /*some code*/
  
  IF OBJECT_ID('tempdb..dbo.##Temp2') Is not null
  Begin
  PRINT 'DROPPED' -- not printed
  DROP TABLE ##Temp2  
  End 
  
  
   End
  </code></pre>
  
  <p>Since 'DROPPED' is not printed, it clearly means table does not get deleted, but why is that ? I am not dropping table anywhere else. Besides, I do not get this error :</p>
  
  <pre><code>There is already an object named ##Temp2 in the database
  </code></pre>
  
  <p>if I drop the table before starting to execute it. What exactly may be the problem and what I may do to resolve the issue ?</p>