In SQL server we have 2 types of temporary tables:
##GlobalTempTable
is a type of temporary table that is sheered between all user's sessions.#LocalTempTable
temp tab - it is a type of temporary table that only exists in current scope (only in actual process - you can get id of your current process by SELECT @@SPID
)Droping process of temporary tables is the same as for normal table:
DROP TABLE [ database_name . [ schema_name ] . | schema_name . ] table_name
BEFORE SQL Server 2016:
IF(OBJECT_ID('tempdb..#TempTable') is not null)
DROP TABLE #TempTable;
SQL Server 2016:
DROP TABLE IF EXISTS #TempTable