Quantcast
Channel: Rob Bamforth's Blog
Viewing all articles
Browse latest Browse all 35

SQL – Check If A Table Exists

$
0
0

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

 

 



Viewing all articles
Browse latest Browse all 35

Trending Articles