OBJECT_NAME (T-SQL)

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 to 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(117575457)

  

Here is the result set:

TABLE_CATALOG                  TABLE_NAME  

------------------------------ --------------

pubs                           authors      

  

(1 row(s) affected)

  

See Also

Metadata Functions

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.