To check if a database object exists, use OBJECT_ID function. If the object is found, its system ID is returned, otherwise NULL is returned.
IF OBJECT_ID('tblMyTable') IS NOT NULL PRINT 'Table found' ELSE PRINT 'Table not found'
To check if a database object exists, use OBJECT_ID function. If the object is found, its system ID is returned, otherwise NULL is returned.
IF OBJECT_ID('tblMyTable') IS NOT NULL PRINT 'Table found' ELSE PRINT 'Table not found'