Specifies the database with which you want to work.
is the name of the database to open.
use pubs2 go
The current database is now pubs2.
The use command must be executed before you can reference objects in a database.
use cannot be included in a stored procedure or a trigger.
sp_addalias adds an alias, which permits a user to use a database under another name to gain access to that database.
SQL92 – Compliance level: Transact-SQL extension.
If the database has a “guest” account, all users can use the database. If the database does not have a “guest” account, you must be a valid user in the database, have an alias in the database, or be a System Administrator or System Security Officer.
Commands – create database, drop database
System procedures – sp_addalias, sp_adduser, sp_modifylogin