Previous Topic

Next Topic

Book Contents

Book Index

Saving and opening a query

To Save or Open a query, click on File > Save Query or File > Open Query (or Save/Open icons) from the Run SQL window.

AQT maintains a list of the last 10 queries saved/retrieved. These appear in the File menu, and provide a very quick way of retrieving a recently-saved query.

You cannot save queries in the Evaluation mode of AQT.

Once you have saved or retrieved a query, the query name will be given as part of the caption in the window title bar. This query name will be followed by an * if the query has been changed since the last time it was saved. The query name is also given in the status bar at the bottom of the window.

If you have changed a query, and you either close the window, or do anything that overwrites the SQL (such as retrieving another query), you will be prompted to save the query. You can turn off this prompt by de-selecting Options > Run SQL > Prompt to Save Query.

Save / Open Dialog

When you click on the Save Query or Open Query options, you will be taken to the Save/Open dialog.

v10OpenSave

This has a number of features:

More Features

There are a number of features to help you find a particular query you are looking for:

Both the Filter, Recent and Search Files are particular powerful if you have the Sub-Dirs option set. These provide a means to search an entire directory structure.

Deleting and Renaming Multiple Files

This can only be done when you are in Open Query mode (in Save Query mode, multiple files cannot be selected).

To delete multiple files, select the files then click on the Delete button.

To rename multiple files, select the files then click on the Rename button. You will be prompted with the Rename File dialog, with a filename of <name>. Modify the <name> to specify how the new file names are to be contructed. The general syntax for this is given in Load Mapping Specification. Examples:

Specification

File Name

Renamed File Name

<name>_test

C:\AQT\Queries\employee_query.sql

C:\AQT\Queries\employee_query_test.sql

<name:rep(query,new)>

C:\AQT\Queries\employee_query.sql

C:\AQT\Queries\employee_new.sql

<name:beforelast(_)>

C:\AQT\Queries\employee_query.sql

C:\AQT\Queries\employee.sql

new_<name:left(6)>

C:\AQT\Queries\employee_query.sql

C:\AQT\Queries\new_employ.sql

This feature cannot be used to change either the directory name or file extension of the files.

Large Files

If you have a large query you may wish to use Run from File. This bypasses the need for AQT to import the SQL into Editor box on the SQL window - this can be time-consuming for a large query.

File is Read Only

When you select a file, AQT shows you whether the file is read-only (has the read-only flag set in the file attributes). If you change this setting, AQT will change the attributes of the file.

If you open a read-only file, AQT will not allow you to save it. You will have to save it under a different name.

Query / Home Directory

Your default / home directory for saved queries is specified in Options > File Locations. This will be the directory you will be taken into the first time you save / retrieve a query in your session. If you change to another directory you can quickly return to this default directory by clicking on the Go to Home Directory icon.

Clicking on the Set this as Home Directory will set the current directory as your home directory.

Shared Queries

If you are using Shared Queries, you will have both a Home and Shared Home buttons.The Shared Home button takes you to the Shared Queries directory.

If Allow Changes to Shared Queries is set to None, you will not be make any changes to the Shared Queries.

Opening Multiple Files

You can select multiple files (by clicking on files in conjunction with the Ctrl or Shift keys). AQT will concatenate the files together when retrieving them to the Run SQL window. It will also add a delimiter character between them.

If you select Run From File, multiple <file> specifications will be written to the SQL window.

The files will be opened in the order they are on the window, not the order in which they were selected.

Column Sort Order

The files can be displayed in a particular order by clicking on the column heading.

Your display order is saved between sessions. This allows you to always see the files displayed in your preferred order.

Microsoft Open/Save Dialog

If you prefer to use the Microsoft Open/Save dialog, rather than the AQT dialog, you can set this in Options > Run SQL > Use standard Windows open/save dialog.