Archive

Archive for March 11, 2011

SQL – Check If A Table Exists

March 11, 2011 Leave a comment

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

 

 

Categories: SQL Tags: , , , ,
Follow

Get every new post delivered to your Inbox.