如果在 SQL Azure 上存在临时表,则删除该临时表。

6 浏览
0 Comments

如果在 SQL Azure 上存在临时表,则删除该临时表。

在Azure SQL上有更好的方法来删除临时表吗?

BEGIN TRY
    DROP TABLE #customMap
END TRY
BEGIN CATCH
END CATCH

也许在Azure SQL上没有必要删除临时表,因为当会话结束时表会被删除。

if (OBJECT_ID('#candidates')) is not null
begin
    drop table #candidates;
end;

或者

if (OBJECT_ID('tempdb..#candidates')) is not null
begin
    drop table #candidates;
end;

都不起作用。

0