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

db_id()

The system function db_id() returns the identification number (id) of a database. The function db_id() is a Transact-SQL extension. It can be executed by any user.

Syntax of the System Function db_id()

    db_id (database_name)
    

The parameter of the System Function db_id()

"database_name"
The parameter "database_name" is the name of a database, as stored in the column "name" of the system table sysdatabases. If the parameter "database_name" is not specified, the function db_id() returns the identification number of the database currently in use.

Example for the System Function db_id()

    select db_id("tempdb")
go
-----
2

Returns the id (2) of the database "tempdb".

See also:

ASE T-SQL - Aggregate Functions,
audit_event_name(),
col_length(),
col_name(),
curunreservedpgs(),
datachange(),
datalength(),
data_pages(),
data_pgs(),
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,
tempdb_id(),
tran_dumpable_status(),
tsequal(),
used_pages(),
used_pgs().