A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  special characters  sybase-tech-blog


Category: ASE: Functions: System Functions

object_name()

The system function object_name() returns the name of an object referenced in the value specified by the parameter object_id, or NULL, if the object does not exist. The function object_name() is a T-SQL extension. It can be executed by any user.

Syntax of the System Function object_name()

    object_name(object_id [, database_id])
    

The parameters of the System Function object_name()

"object_id"
The parameter "object_id" is the identification number (id) of the object for which the name shall be returned. The object can be of any of the types: table, view, trigger, procedure, default or rule. The id of objects is stored in the column "id" of the system table sysobjects. "database_id"
The parameter "database_id" describes the identification number (id) of the database in which the object, for which the name should be displayed, is stored. This id must be specified, if the object is not stored in the database currently in use. The "database_id" can be retrieved from the column "dbid" of the system table sysdatabases.

Example for the System Function object_name()

    select object_name(208003772)
    
    ------------------------------ 
    titles
    

Returns the name of the object with identification number 208003772, in this case, the name of the "titles" table.

    select object_name(1, 1)
    
    ------------------------------ 
    sysobjects 
    

Returns the name of the table "sysobjects" in the database "master" (dbid = 1).

See also:

ASE T-SQL - Aggregate Functions,
audit_event_name(),
col_length(),
col_name(),
curunreservedpgs(),
datachange(),
datalength(),
data_pages(),
data_pgs(),
db_id(),
db_name(),
host_id(),
host_name(),
identity(),
index_col(),
index_colorder(),
isnull(),
lct_admin(),
license_enabled(),
lockscheme(),
next_identity(),
object_id(),
pagesize(),
pointer_size(),
ptn_data_pgs(),
reserved_pages(),
reserved_pgs(),
rowcnt(),
row_count(),
showplan_in_xml(),
syb_sendmsg(),
syb_sendmsg(),
System Functions,
tempdb_id(),
tran_dumpable_status(),
tsequal(),
used_pages(),
used_pgs().