Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
Returns the database ID number.
DB_ID( [ database-name ] )
database-name A string containing the database name. If no database-name is supplied, the ID number of the current database is returned.
INT
Cloud note: Because of tenant database isolation rules, when this function is called in the cloud it returns only information about the current tenant database.
None
SQL/2008 Vendor extension.
The following statement returns the value 0, when executed against the SQL Anywhere 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( );