You can use the SQL Server Query Analyzer to execute and analyze SQL queries. To start the Query Analyzer, select Tools, then SQL Server Query Analyzer from the Enterprise Manager, or select Start, then Programs, then Microsoft SQL Server, and then Query Analyzer.
The system first establishes a connection to a server, and a Connect To SQL Server dialog box prompts the user to enter the server name, user name, and password, if necessary. The Query Analyzer then appears with a window similar to the one shown in Figure 19-31. You can select the database to which the SQL commands are to be applied in the top right pane of the window. As shown in the figure, we selected the ContosoSQL database for this example.