DB_NAME

Returns the database name.

Syntax

DB_NAME ( [ database_id ] )

Arguments

database_id

Is the identification number (ID) of the database to be returned. database_id is int, with no default. If no ID is specified, the current database name is returned.

Return types

sysname

Examples

SELECT DB_NAME (DB_ID()) as [Current DB name];

See Also