Displays the name of the database with the specified ID number.
db_name([database_id])
select db_name()
select db_name(4)
------------------------------ sybsystemprocs
If you do not specify database_id, db_name returns the name of the current database.
See also Transact-SQL Users Guide.
ANSI SQL – Compliance level: Transact-SQL extension.
Any user can execute db_name.