Quantcast
Channel: SCN: Message List - SAP Advantage Database Server
Viewing all articles
Browse latest Browse all 997

Store Procedures do not delete temp tables created in that procedure

$
0
0

We have noticed that when we use a temp table in a stored procedure and then execute the procedure, the temp table remains.  So if we execute the procedure again, it will fail with a table already exists error.

 

Are we missing something?  Here is what we are trying to do:

 

CREATE PROCEDURE SessionVariableGetMany

   (

      SessionId CHAR ( 16 ),

      VarNames CHAR ( 2000 ),

      CURSOR VARYING OUTPUT

   )

 

 

BEGIN

  Declare @Sql char(2000);

  @Sql = 'Select SV_Key, SV_Value Into #tempSVGM From SessionV Where SV_CustNum = ''' + _SessionID + ''' And SV_Key In (' + RTrim(_VarNames) + ');';

 

 

  Execute Immediate RTrim(@Sql);

 

 

  Select * From #tempSVGM;

 

 

END;

 

Any insight into this would be greatly appreciated.

 

Dave Anderson


Viewing all articles
Browse latest Browse all 997

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>