OBJECT_NAME

Transact-SQL Reference

Transact-SQL Reference

OBJECT_NAME

Returns the database object name.

Syntax

OBJECT_NAME ( object_id )

Arguments

object_id

Is the ID of the object to be used. object_id is int.

Return Types

nchar

Remarks

When the parameter of a system function is optional, the current database, host computer, server user, or database user is assumed. Built-in functions must always be followed by parentheses.

System functions can be used in the select list, in the WHERE clause, and anywhere an expression is allowed. For more information, see Expressions and WHERE.

Examples

This example returns the OBJECT_NAME for the authors table in the pubs database.

USE pubs
SELECT TABLE_CATALOG, TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = OBJECT_NAME(1977058079)

Here is the result set:

TABLE_CATALOG                  TABLE_NAME   
------------------------------ --------------
pubs                           authors       

(1 row(s) affected)

See Also

Metadata Functions