SQL Server 2000 query Analyzer

Source: Internet
Author: User

Know "query analyzer"

Start the Service Manager and open the Enterprise Manager.

Select the database to be operated (taking my sky2098 as an example), and select "SQL query analyzer" in "Tools" on the menu bar ":

If the "Object Browser" on the left is not displayed, you can do this:

Select the "Tools" tab on the toolbar and select the "show/hide" option in the expanded list of the first "Object Browser" to see the "Object Browser ".

Another way is to open "Object Browser" and use the shortcut key F8.

Basic database query operations

To query all records in the database sky2098, you only need to run the following command in the "query" area on the right:

Select * from student

Select execution to query all the records in the student table. The following three methods can be used to execute the query:

The first option is to select the "execute" option on the "query" list sheet on the menu bar;

Second, click the green triangle icon on the toolbar;

The third option is to use the shortcut key F5 for direct execution. The query results are as follows:

Of course, we can write two or more query statements:

Select name from student

Select * from student

Result After execution

Each query statement corresponds to a form of query results.

Use "Object Browser" to execute SQL commands

If we want to query some attribute columns of the database table, and these attribute names are not easy to remember, it is easy to have a wrong key.

In this case, you can use "Object Browser" to expand the database (sky2098) to be operated, expand "User table", and operate the tables in it.

(DBO. Student), expand the DBO. Student node, you can see some options, expand the "column" node again, you can view

Attribute name. After selecting the keyword in the "query" area on the right, you can specify the section in the "Object Browser" on the left.

Point (such as the table name and column name) to the specified position ,:

Use "SQL template" to execute SQL commands

To run SQL commands using an SQL template, you can use the following method:

Method 1:

Drag the template directly to the query window on the "template" tab of "Object Browser;

After the template is inserted, you must modify the parameters in the template to execute:

Select "replace template parameters" from the "edit" drop-down list on the menu bar. The following dialog box is displayed:

Replace test_db with the name of your database:

Select the "replace all" button to query the content changes in the window:

Click the execute command button to create a database named sky2098sky2098. You can also see the execution status in the result window:

Refresh the MMC to see the new database:

Method 2:

Click the "insert template" option in the "edit" list on the menu bar. The following dialog box is displayed:

Select a folder:

Click "open:

The tql file in the selected folder:

Select the OPEN button:

You can see a table created using the template in the query window, and then you need to replace and set some parameters in the template. The method is the same as that described in the first method.

Method 3:

Select the small black triangle on the right of the shortcut icon in the toolbar. A drop-down list is displayed:

You can also insert an SQL template.

View query results and save results

Display query results in a grid:

To save the query result, right-click the grid in the grid area and select the grid:

Then, save the query result:

The "Save table result" dialog box is displayed:

Fill in the "File Name". The default file name is the CSV format file extension. Select "save". We can use NotePad to open the result file:

Of course, if the Microsoft EXCEL program is installed, it is better to use this format to open it:

Display query results in text format:

In this way, you can set the storage methods for various query results.

However, when saved as text, it is saved as a report file (. rpt format.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.