object_name

Description

Returns the name of the object whose object ID is specified.

Syntax

object_name(object_id[, database_id])

Parameters

object_id

is the object ID of a database object, such as a table, view, procedure, trigger, default, or rule. Object IDs are stored in the id column of sysobjects.

database_id

is the ID for a database if the object is not in the current database. Database IDs are stored in the db_id column of sysdatabases.

Examples

Example 1

select object_name(208003772)

------------------------------ 
titles

Example 2

select object_name(1, 1)

------------------------------ 
sysobjects 

Usage

Standards

SQL92 – Compliance level: Transact-SQL extension.

Permissions

Any user can execute object_name.

See also

Functions col_name, db_id, object_id

System procedures sp_help