Skip to content
Advertisement

Drop a temporary table if it exists

I have two lines of code in SQL that create two tables on the fly, i need to do something like

my lines are the following ones

how can I apply that concept for these two tables in my procedure?

Advertisement

Answer

From SQL Server 2016 you can just use

On previous versions you can use

You could also consider truncating the table instead rather than dropping and recreating.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement