db_name

Displays the name of the database with the specified ID number.

Syntax

db_name([database_id])

Parameters

Examples

Usage

If you do not specify database_id, db_name returns the name of the current database.

See also Transact-SQL Users Guide.

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute db_name.

Related reference
col_name
db_id
object_name