OBJECT_ID

Returns the database object identification number of a schema-scoped object.

Syntax

OBJECT_ID ( '[ database_name . [ schema_name ] . | schema_name . ]   
  object_name' [ ,'object_type' ] )

Arguments

' object_name '

Is the object to be used. object_name is either varchar or nvarchar. If object_name is varchar, it is implicitly converted to nvarchar. Specifying the database and schema names is optional.

' object_type '

Is the schema-scoped object type. object_type is either varchar or nvarchar. If object_type is varchar, it is implicitly converted to nvarchar.

Return types

int

Example

SELECT OBJECT_ID(N'AdventureWorks2012.Production.WorkOrder') AS 'Object ID';

See Also