object_id

Description

Returns the object ID of the specified object.

Syntax

object_id(object_name)

Parameters

object_name

is the name of a database object, such as a table, view, procedure, trigger, default, or rule. The name can be fully qualified (that is, it can include the database and owner name). Enclose the object_name in quotes.

Examples

Example 1

select object_id("titles")

----------- 
  208003772 

Example 2

select object_id("master..sysobjects")

----------- 
          1

Usage

Standards

SQL92 – Compliance level: Transact-SQL extension.

Permissions

Any user can execute object_id.

See also

Functions col_name, db_id, object_name

System procedure sp_help