Check if a temporary table exists and delete if it exists before creating a temporary table

前端 未结 15 790
忘掉有多难
忘掉有多难 2020-11-29 14:13

I am using the following code to check if the temporary table exists and drop the table if it exists before creating again. It works fine as long as I don\'t change the colu

15条回答
  •  被撕碎了的回忆
    2020-11-29 15:11

    Now you can use the below syntax if you are using one of the new versions of SQL Server (2016+).

    DROP TABLE IF EXISTS schema.yourtable(even temporary tables #...)
    

提交回复
热议问题