In SQL Server, the OBJECTPROPERTY()
function returns information about schema-scoped objects in the current database.
These schema-scoped objects are the ones you can see by querying the sys.objects
system catalog view. It can’t be used for objects that are not schema-scoped.
You can use OBJECTPROPERTY()
to check if an object is a table, view, stored procedure, etc. You can also use it to check if a table has a primary key, foreign key, foreign key reference, etc.