The db_id returns a number that is id of the database.
DB_ID() Syntax:
DB_ID()
DB_ID ( 'database_name' )
DB_ID() Example:
SELECT DB_ID() AS Database_1,
DB_ID(N'master') AS Database_2;
Database_1 | Database_2 |
---|---|
1 | 1 |
See also: T-SQL Functions -> APP_NAME | DB_NAME | OBJECT_DEFINITION | OBJECT_ID