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_id()

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

Syntax of the System Function object_id()

    object_name(object_name)
    

The parameters of the System Function object_id()

"object_name"
The parameter "object_name" is the name of the object for which the identification number shall be returned. The object can be of any of the types: table, view, trigger, procedure, default or rule. The name of objects is stored in the column "name" of the system table sysobjects. The value of the parameter "object_name" must be set in quotes. It can be specified fully qualified, i.e. combining the database name, object owner and object name.

Example for the System Function object_id()

    select object_id("titles")
    
    ------------------------------ 
    208003772 
    

Returns the identification number of the object called "titles", in this case the id of the table "titles".

    select object_id("master.dbo.syslogins")
    
    ------------
              33 
    

Returns the id (33) of the table "syslogins" stored in the database "master".

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_name(),
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().