如果 temp table 存在于 SQL Azure 上,则删除它
Drop temp table if it exists on SQL Azure
是否有更好的方法来降低 Azure SQL 上的温度 table?
BEGIN TRY
DROP TABLE #customMap
END TRY
BEGIN CATCH
END CATCH
也许不需要在 Azure SQL 上删除临时 tables,因为 tables 在会话结束时被删除。
这个
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;
无效。
IF OBJECT_ID('tempDB..#myTempName','U') IS NOT NULL
drop table #myTempName
临时表是在 tempDB
中创建的,而不是您当前用作默认数据库的任何数据库。
在 Azure SQL 数据库中,您可以使用 DROP IF EXISTS (DIE) 语法:
create table #temp (id int)
drop table if exists #temp
是否有更好的方法来降低 Azure SQL 上的温度 table?
BEGIN TRY
DROP TABLE #customMap
END TRY
BEGIN CATCH
END CATCH
也许不需要在 Azure SQL 上删除临时 tables,因为 tables 在会话结束时被删除。
这个
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;
无效。
IF OBJECT_ID('tempDB..#myTempName','U') IS NOT NULL
drop table #myTempName
临时表是在 tempDB
中创建的,而不是您当前用作默认数据库的任何数据库。
在 Azure SQL 数据库中,您可以使用 DROP IF EXISTS (DIE) 语法:
create table #temp (id int)
drop table if exists #temp