SQLConfiguration SQLConfiguration


SQL Server  «Prev 

Using the Query Analyzer

To use the Query Analyzer:
  1. Click Start>>Programs>>Microsoft SQL Server 2012 >>Query Analyzer.
  2. Click the down arrow to the right of the Database text box to display the drop-down menu.
  3. Select the master database. (Normally when you roll your mouse cursor over the various selections, they will be highlighted. In this case, simply click master.)
  4. Click in the upper-left corner of the Query Pane and type select name from sysusers. Then click the Execute Query button (green arrow button) to execute the query.
  5. View the results of your query in the Results grid.

Interacting Through the Query Window

This part of the Management Studio takes the place of what was, at one time, a separate tool that was called Query Analyzer. The Query window is your tool for interactive sessions with a given SQL Server. It is where you can execute statements using Transact-SQL (T-SQL). I pronounce it �Tee-Squeal,� but it is supposed to be "Tee-Sequel." T-SQL is the native language of SQL Server and is a dialect of Structured Query Language (SQL), and is largely compliant with modern ANSI/ISO SQL standards. You will that most RDBMS products support basic ANSI/ISO SQL compatibility. Because the Query window is where you will spend a fair amount of time, let us take a more in-depth look at this tool and get familiar with how to use it.

Getting Started

Follow these steps:
  1. Open a new Query window by clicking the New Query button toward the top-left of the Management Studio or choosing
    File -> New -> New Query With Current Connection from the File menu.
    When the Query window opens, you will get context-sensitive menus and toolbar buttons designed for T-SQL. Before you look at the specifics, let us get your very first query out of the way.
  2. Select AdventureWorks in the database dropdown box on the SQL Editor toolbar.
  3. Type the following code into the main window of the Query window: SELECT * FROM Person.Address;