Returns the database ID number.
DB_ID( [ database-name ] )
A string containing the database name. If no database-name is supplied, the ID number of the current database is returned.
INT
None
None
Not in the standard.
The following statement returns the value 0, when executed against the sample database as the sole database on the server:
SELECT DB_ID( 'demo' );
The following statement returns the value 0 if executed against the only running database:
SELECT DB_ID( );