db_id

Displays the ID number of the specified database.

Syntax

db_id(database_name)

Parameters

Examples

Usage

If you do not specify a database_name, db_id returns the ID number of the current database.

See also Transact-SQL Users Guide.

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute db_id.

Related reference
db_name
object_id