Querying Databases in SQL Server 2005 - Creating a Query
(Page 2 of 4 )
After you start the Studio, you need to hit the New Query button, which changes the center region, which is now showing SQL Server AGENT as in Fig.2, in a new tab. This action also changes the main menu by adding the Query menu item.
Fig.2
Fig.3 shows how you may open up the querying tool. By clicking on the Query menu item in the Studio, you get access to all of its functionality. From this drop-down list it can be seen that all the functionalities are retained with a couple of additional ones such as SQLCMD mode, include/reset client statistics, etc.
The vertical drop-down sub-menu items are also repeated horizontally at the top of the query editor, as can be seen in Fig.4. You may also set the database you need to query using the drop-down (partially hidden in this figure by the Query drop-down, showing only part of Northwind). The Connection menu item lets you make a connection; Disconnect disconnects all queries, or changes the connection. The Design Query in Editor... will wake up the query editor with all needed items, as we will see later. The Results To lets you show the result of a query in a text, Grid, or file, functionality that is similar to what was in SQL 2000. The Query Option... submenu lets you configure the parameters needed by both the executed query as well as the result set returned.
Fig. 3
Fig.4 shows a simple query in the Query design plane. This pane is tabbed and clicking on the Summary tab; you would see summary information. This also shows the Northwind database being queried as well as two queries that can be tabbed for editing, or access. After you finish coding your query, you may test the syntax by going to Query ->Parse (or use the keyboard shortcut: CTRL+F5). Again it is assumed that developers/users will be transitioning from SQL Server 2000 to Studio and therefore they could customize their keyboard to emulate SQL Server 2000. The keyboard can be customized from the Tools menu as seen in Fig.5 by going to Tools ->Options and choosing Keyboard in the Environment node. The Standard Keyboard refers to the Studio default.
Keyboard to emulate SQL 2000 command keys
Fig. 4

Fig. 5

Next: The Execution Plan >>
More MS SQL Server Articles
More By Jayaram Krishnaswamy