Check if table exists in SQL Server

前端 未结 28 1896
梦如初夏
梦如初夏 2020-11-22 04:23

I would like this to be the ultimate discussion on how to check if a table exists in SQL Server 2000/2005 using SQL Statements.

When you Google for the answer, you g

28条回答
  •  执笔经年
    2020-11-22 04:46

    Run this query to check if the table exists in the database:

    IF(SELECT TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'YourTableName') IS NOT NULL
    PRINT 'Table Exists';
    

提交回复
热议问题