SQL – Check If A Table Exists
Check if a table exists in a database:
IF OBJECT_ID(‘database.dbo.table’) > 0
BEGIN
//Code to run if table exists. e.g. delete table.
//drop table database.dbo.table
END
Advertisement
Check if a table exists in a database:
IF OBJECT_ID(‘database.dbo.table’) > 0
BEGIN
//Code to run if table exists. e.g. delete table.
//drop table database.dbo.table
END