Database Reference
In-Depth Information
Figure 5-9. The SQL Server Management Studio UI
he Query Window
The second main window used on a regular basis is the query window. As indicated in Figure 5-9 , there is a
button on the toolbar called New Query which opens a new query window for you. This window is actually a set
of windows, and just like modern web browsers, you can have many query windows open and each is accessed
by its tab. Each tabbed query window has its own unique connection to a database engine.
By default each query window opens in the center of SQL Server Management Studio. Once opened, one or
more SQL commands can be typed into a query window and then executed separately or collectively.
A query window must be connected in order to execute SQL code. In Figure 5-9 , the disconnected status at
the bottom of the screen is a clear indication that the query window is not yet connected. Disconnected queries
are easily remedied by right-clicking anywhere on a query window, choosing the Connection option from the
context menu, and selecting Connect.
It is important to note that the Object Explorer window represents a separate connection. You may be
connected to a database engine in the Object Explorer, but you are not necessarily connected to a database
engine in a query window. This can often be a source of confusion because developers expect one application
to have only a single connection to a server at a time. Once you are able to get past the confusion, it is a
very convenient feature nonetheless, since it allows you to work with multiple servers at once from a single
application.
 
Search WWH ::




Custom Search