Use OBJECTPROPERTY and OBJECT_ID to check the table existance : OBJECTPROPERTY « System Settings « SQL Server / T-SQL Tutorial






5> USE master
6> SELECT OBJECTPROPERTY(OBJECT_ID('syslockinfo'), 'TableIsFake'),
7>     OBJECTPROPERTY(OBJECT_ID('sysobjects'), 'TableIsFake')
8> GO
Changed database context to 'master'.

----------- -----------
       NULL        NULL

(1 rows affected)
1>








26.20.OBJECTPROPERTY
26.20.1.Returning Information about User-Defined Functions
26.20.2.Using the OBJECTPROPERTY Function to Check Whether a View is Indexable
26.20.3.Check with OBJECTPROPERTY function
26.20.4.Use OBJECTPROPERTY and OBJECT_ID to check the table existance