Returns the database ID number.
DB_ID ( [ database-name ] )
database-name A string expression containing the database name. If database-name is a string constant, it must be enclosed in quotes. If no database-name is supplied, the ID number of the current database is returned.
The following statement returns the value 0, if asiqdemo is the only running database:
SELECT DB_ID( 'asiqdemo' ) FROM iq_dummy
The following statement returns the value 0, if executed against the only running database.
SELECT DB_ID() FROM iq_dummy