Home arrow SQL Server arrow Page 2 - 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 2 of 10 )

So what exactly does this chapter cover and what are these areas in Query Analyzer? By the time you reach the summary, you will:
  • Know what Query Analyzer is
  • Know how to start Query Analyzer and log in successfully
  • Have learned how to use the Object Browser to find database objects
  • Have explored the templates tab and learned what templates are
  • Know how to use the menu and know where to find specific commands
  • Have learned how to change the database you are working with
  • Have seen the different methods of displaying output
  • Have figured out how to customize Query Analyzer
  • Have learned what options are available on the toolbar
  • Be able to create a new login account
  • Be able to change which database a user is automatically connected to
This list demonstrates what a powerful tool Query Analyzer is, and gives us quite a large amount of information to cover in one chapter but, trust me, it's not all that bad.

So, without further ado, let's dive right in and have a look at how to start Query Analyzer.

Starting Query Analyzer

Query Analyzer can be started in two different ways, from within Enterprise Manager and from the Start menu button. In this section of the chapter, both of these methods will be demonstrated, as each does have minor idiosyncrasies concerning logging in to SQL Server. First of all, let's take a look at how to start Query Analyzer from Enterprise Manager.

Starting from Enterprise Manager

Probably the most common way to start Query Analyzer is from within Enterprise Manager. You will have navigated to your server in Enterprise Manager, and then will realize that you need Query Analyzer to perform some function or other.

As soon as you open up Enterprise Manager and select a server, a connection attempt is made to that server through SQL Server Service Manager. If the connection is successful then, of course, you can proceed with using the databases, etc. within that server. You should not have any problems with your connections to the server installation built in this book.

If you have not highlighted a node in Enterprise Manager at the server level (for example, if you are at the SQL Server Group level, or above), then Query Analyzer will not log on to a server automatically. This is covered in the next section.

Also remember that Enterprise Manager will display multiple servers. I would expect that, as a developer, you would have at least two servers: your development server and your test server. So take care that you are working with the right one.
{mospagebreak title=Chapter 3: Query Analyzer (contd.)&toc=1} Try It Out Starting Query Analyzer from Enterprise Manager

1. SQL Server should be up and running at this point. If not, then start up SQL Server as you were shown in Chapter 2. Now start up Enterprise Manager and navigate to the server that you want to have Query Analyzer connect to at its startup, by default. As you can see, I have chosen the initial WONDERBISON server, built when SQL Server was installed.

2. From the Tools menu, select SQL Query Analyzer:

3. From here, you should find that Query Analyzer has started up, is in the correct server, and is ready to accept any instructions that you wish to pass to it. You can tell that it is the correct server by the first WONDERBISON listed in the title bar.

So, a connection has been made and it is valid. You have also explicitly said to Enterprise Manager that you wish to use the Query Analyzer tool. Therefore, Enterprise Manager quite rightly makes the assumption that it is the current login that wants to start up Query Analyzer, and that Query Analyzer is required for work with the server that is currently highlighted in Enterprise Manager. Consequently, Enterprise Manager passes the current connection information through to the SQL Server engine as parameters with the command to start Query Analyzer. These parameters allow Query Analyzer to log in and be ready for work on the right server without any input from you.

4. The next screenshot shows how the title bar differs when Query Analyzer is connected to a different server. Notice how master in the title bar is prefixed with SYSTESTSERVER now:

Starting from the Start Button

The second possible way of starting Query Analyzer is from the Start button on the taskbar. Let's have a look at this.

1. By selecting Start | Programs | Microsoft SQL Server | Query Analyzer, Query Analyzer will start up on your machine. However, this time, you will have a login screen to contend with. You should see either of the two screens below, depending on how you have installed SQL Server, and defined the login options for the server. The first screen is attempting to log on through SQL Server Authentication, while the second is attempting to log on through Windows Authentication. Recall Chapter 1, where Windows Authentication and SQL Server Authentication were discussed. Both screens are valid.

2. If you make sure that you have entered the right Login name and Password for the first of these windows, and that the Start SQL Server if it is stopped check box is checked in both cases, when you click on OK, you will log in to SQL Server exactly as if you went through Enterprise Manager. However, things are working a bit differently behind the scenes, so let's go through that now.

In the first screenshot of the two above, you will see that SQL Server authentication is being used, and that the sa User ID is used as the login name. If you remember, in Chapter 2 I mentioned that the sa login should not be used unless absolutely necessary, and it should also be password protected. sa is the default login name when Query Analyzer opens, but if everyone uses it, it becomes very difficult to track who is actually doing what in SQL Server and who is causing problems.
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