object_id

Returns the object ID of the specified object.

Syntax

object_id(object_name)

Parameters

Examples

Usage

  • object_id, a system function, returns the object’s ID. Object IDs are stored in the id column of sysobjects.

  • Instead of consuming resources, object_id discards the descriptor for an object that is not already in the cache.

See also:
  • Transact-SQL Users Guide

  • sp_help in Reference Manual: Procedures

  • sysobjects in Reference Manual: Tables

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute object_id.

Related reference
col_name
db_id
object_name