Specifies the active/current database for the session.
If a database and schema, also known as a namespace, are not specified for a user session, all objects reference in SQL statements or queries executed in the system must be fully-qualified (in the form of
db_id.schema_id.object_id). Specifying a database and schema for a user session enables using unqualified object names in SQL statements and queries.
For more information about fully qualified object names, see Object Name Resolution.
USE [ DATABASE ] <name>
Specifies the identifier for the database to use for the session. If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.
DATABASEkeyword does not need to be specified.
USE DATABASE automatically specifies PUBLIC as the current schema, unless the PUBLIC schema doesn’t exist (e.g. it has been dropped). To specify a different schema for a session, use the USE SCHEMA command.
USE DATABASE mydb;