Connection Status

Some client tools may not clearly indicate connection status. A failed command is your first indication that the connection does not exist.

A quick way to confirm the connection is by querying the database name.

To display the current database, use this syntax:

select db_name()

To specify a different database, use this syntax:

select db_name([ database_id ])
Related concepts
Ways to Connect
Supported Connection Interfaces
How Connection Parameters Work
Connection Parameters in ODBC Data Sources
Interactive SQL Connections
File Data Sources
Connections from Other Databases
How to Test Connections
Integrated Logins
Connection Pooling
Temporary Connections
Logical Server Configuration
How to End Connections
Connection Logging
Related reference
Roadmap for Connections