Why are temporary tables not removed from tempdb in SQL Server?

前端 未结 4 537
遥遥无期
遥遥无期 2021-01-20 20:09

I have created one stored procedure with 7 temporary tables and each temp table is dropped at the end of their own work.

I am calling the SP from one web service and

4条回答
  •  走了就别回头了
    2021-01-20 20:44

    To force dropping of temp tables use

    BEGIN TRY DROP #MyTable END TRY BEGIN CATCH END CATCH
    

    Ugly but effective. Use a separate TRY for each temporary table.

提交回复
热议问题