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

tempdb_id()

The system function tempdb_id() returns the identification number (id) of the temporary database to which a session, i.e. an existing connection to the dataserver, has been assigned.

The system function "tempdb_id()" is a T-SQL extension. The function is available in ASE starting with version 12.5.0.3.

Syntax of the System Function tempdb_id()

    tempdb_id(["spid"])
    

The parameter der System Funktion tempdb_id()

"spid"
The parameter "spid" is the number of the process on the ASE- server. This "server process id" can be retrieved from the column spid of the system table sysprocesses. The return value corrsponds to the database id of the temporary database to which the specified "spid" has been assigned. If the parameter "spid" is not specified, the return value shows the id for the temporary database of the current session.

select tempdb_id()
is equivalent to the result of
select @@tempdbid
. Using the id, the database name can be retrieved from the column "name" of the system table sysdatabases.

Example for the System Function tempdb_id()

    1> select tempdb_id()
    2> go
        
    ------ 
         2
    

Returns the identification number (2) of the temporary database for the current session.

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(),
object_name(),
pagesize(),
pointer_size(),
ptn_data_pgs(),
reserved_pages(),
reserved_pgs(),
rowcnt(),
row_count(),
showplan_in_xml(),
syb_sendmsg(),
syb_sendmsg(),
System Functions,
tran_dumpable_status(),
tsequal(),
used_pages(),
used_pgs().