- Database, Schema, & Share DDL
Specifies the active/current schema 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_name.schema_name.object_name). 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 [ SCHEMA ] [<db_name>.]<name>
Specifies the identifier for the schema 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.
nameis not fully-qualified (with
db_name), the command looks for the schema in the current database for the session.
SCHEMAkeyword is optional if a database has been specified for the session or the schema name is fully-qualified.
myschema schema in the current database:
otherschema schema in the