SQL-Query Basics  «Prev 

System catalogs

SQL Server Use Command

USE { database }

-- Azure SQL Data Warehouse and Parallel Data Warehouse
USE database_name 
[;]

SQL Server Arguments

database: Is the name of the database or database snapshot to which the user context is switched. Database and database snapshot names must comply with the rules for identifiers.
In Azure SQL Database, the database parameter can only refer to the current database. The USE statement does not switch between databases, and will result in
error code 40508 is returned. To change databases, you must directly connect to the database.

USE Timesheets
GO
SELECT Name 
FROM sysobjects
WHERE type = 'U'
The first step is to switch to the appropriate database by issuing the USE command, followed by the name of the desired database, Timesheets

The GO statement informs SQL Server that a new batch has begun.

The SELECT statement designates which columns from the sysobjects table will be returned by the query

The FROM clause designates that the sysobjects table will be used in this query.

USE Timesheets
GO
SELECT Name 
FROM sysobjects
WHERE type = 'U'
The WHERE clause limits the returned rows to those that are type 'U', which stands for 'User Table'.