Drop temp table if it exists
The following will delete a temp table if it exists.IF (OBJECT_ID(N'tempdb..#temptable', N'U') IS NOT NULL)
DROP TABLE #temptable;
In SQL Server 2016 and higher, you can use the following:
DROP table if exists #temptable;
Last modified by Mohit @ 4/22/2025 8:14:35 AM