Home arrow SQL Server arrow Page 6 - Sample Chapter: Wrox Beginning SQL Server 2000 Programming

Sample Chapter: Wrox Beginning SQL Server 2000 Programming

Wrox are well known for their "How-To" series of books, which teach beginning-intermediate developers how to use Microsoft technologies properly and efficiently. Today, Mitchell takes a look at chapter three from "Beginning SQL Server 2000 Programming", which is published by Wrox Press.

Author Info:
By: Mitchell Harper
Rating: 4 stars4 stars4 stars4 stars4 stars / 23
January 04, 2002
  1. · Sample Chapter: Wrox Beginning SQL Server 2000 Programming
  2. · Chapter 3: Query Analyzer (contd.)
  3. · Chapter 3: Query Analyzer (contd.)
  4. · Chapter 3: Query Analyzer (contd.)
  5. · Chapter 3: Query Analyzer (contd.)
  6. · Chapter 3: Query Analyzer (contd.)
  7. · Chapter 3: Query Analyzer (contd.)
  8. · Chapter 3: Query Analyzer (contd.)
  9. · Chapter 3: Query Analyzer (contd.)
  10. · Summary

print this article

Sample Chapter: Wrox Beginning SQL Server 2000 Programming - Chapter 3: Query Analyzer (contd.)
(Page 6 of 10 )

The Query Analyzer Toolbar

Now that the menus have been covered (with the exception of standard ones like Help and Windows), let's take a quick look at the toolbar buttons. There are many toolbar buttons in Query Analyzer and, like other Microsoft products, these buttons can be removed or new ones added. As you would expect, these toolbar buttons are shortcuts to other options, either found on the menu or in other areas within Query Analyzer. The toolbar is shown below:

To add new buttons, or remove existing buttons, move the mouse pointer over the toolbar,and right- click, which will automatically bring up the Customize Toolbar screen. This screen allows you to move the toolbar buttons around; or by clicking Reset, place the original toolbar buttons back on the toolbar. You may wish to alter your toolbar, but throughout the book, the original toolbar buttons are kept.

We will quickly work through each button next, going from left to right (again, skipping the standard icons like cut and paste).

New Query (Ctrl N)

Pressing this button allows you to create a new empty query window (which includes a Query pane and a Results pane, as normal). If you press the black drop-down triangle next to the button instead, then you receive a list of options of more than just a Blank Query Window. The other options will create a new query window with the relevant template:

Load SQL Script (Ctrl Shift P)

Finds a SQL script on the local hard drive or on a remote computer, and loads this in to a fresh query window.

Save Query/Results (Ctrl S)

Saves the contents of the Query or Results pane depending on which pane the cursor is currently active in to a local disk or remote device.

Insert Template (Ctrl Shift Insert)

Inserts a predefined SQL template into the active Query pane, starting to the right of where the cursor is currently located.

Clear Window (Ctrl Shift Delete)

Will clear the contents of the pane where the cursor is currently active. This could be the Query pane or the Results pane.

Find (Ctrl F)

Will bring up a Find dialog form, allowing you to enter a string to search for in the active Query or Results pane.

Execute Mode

Clicking the black drop-down arrow next to this button produces the menu shown overleaf. The first three options define how any results from a query will be displayed. We won't cover the last three options, as they are quite advanced functions:

Parse Query (Ctrl F5)

Takes the code in the active Query pane and parses it to ensure that it is syntactically correct. Does not check that any objects listed are valid.

Execute Query (F5)

Compiles and executes the SQL code in the current Query pane.

Cancel Query Execution (Alt Break)

This will cancel any query running against a server. However, be wary of this. When you run a query, as mentioned earlier, it doesn't run locally but runs on the SQL Server that you are connected to. Therefore, you are actually sending a command to the server to cancel the execution. If the server is busy running your query, and is not pausing to look to see if there are any other commands to complete, your cancel command will not be dealt with immediately. Therefore, you may find that the cancellation is not instant in some circumstances. Also, this is issuing a command to SQL Server to inform it to rollback the changes applied within the query. This can also make it look as if it is taking a long time to cancel the query when in fact it is working.

Database Combo Box

The database combo box is used by Query Analyzer to inform the user which database is currently connected to. This also provides a quick method for changing databases when your work requires you to do so. It is also very similar to the function keys demonstration earlier in the chapter.

The next section will show you how easy it is to use this combo box to alter the database that you are working with.
blog comments powered by Disqus

- Executing SQL Server Stored Procedure from P...
- How to Search for Date and Time Values Using...
- Replication: SQL Server 2000 - Part 2
- Replication: SQL Server 2000 - Part 1
- SQL Sever: Storing Code in Binary or Text Fi...
- Execute SQL on Multiple Tables/Columns - New...
- How to Connect to a SQL Server from Visual F...
- SQL Server Hardware Tuning and Performance M...
- Primary Key on Multiple Tables New RDBMS C...
- Migrating from Sybase to SQL Server
- What's Best for DBAs? GUI or T-SQL Comma...
- How to Perform a SQL Server Performance Audit
- An Introduction To The Bulk Copy Utility
- SQL Server Stored Procedures 101
- Building Your First SQL Server 2000 Database

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials