DB_ID function [System]

Function

Returns the database ID number.

Syntax

DB_ID ( [ database-name ] )

NoteCIS functional compensation performance considerations apply. See “Conditions that cause processing by SQL Anywhere” in Chapter 3, “Optimizing Queries and Deletions,” in the Performance and Tuning Guide.

Parameters

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.

Examples

The following statement returns the value 0, if iqdemo is the only running database:

SELECT DB_ID( 'iqdemo' ) FROM iq_dummy

The following statement returns the value 0, if executed against the only running database:

SELECT DB_ID() FROM iq_dummy

Standards and compatibility

See also

“DB_NAME function [System]”

“OBJECT_ID function [System]”