Returns the name of the database where the ID number is specified.
db_name([database_id])
is a numeric expression for the database ID (stored in sysdatabases.dbid).
Returns the name of the current database:
select db_name()
Returns the name of database ID 4:
select db_name(4)
------------------------------ sybsystemprocs
db_name, a system function, returns the database name.
If no database_id is supplied, db_name returns the name of the current database.
For general information about system functions, see “System functions”.
ANSI SQL – Compliance level: Transact-SQL extension.
Any user can execute db_name.
Functions col_name, db_id, object_name
Copyright © 2005. Sybase Inc. All rights reserved. |