DB_ID
catalog lookup
What changes
- Input
- catalog metadata (object, column, index, file, database properties)
- Output or change
- id, name or property value
- Return type
- int
Syntax at a glance
DB_ID ( [ 'database_name' ] )
Work example
Resolve a database name to its database id.
Use schema-qualified names and test missing and permission-hidden objects separately.
Check your work Null can mean the database is absent or not visible to the caller.
Open Microsoft Learn for full syntax, permissions, and details for your version.