Previous Topic

Next Topic

Book Contents

Book Index

SQL history

The SQL history can be accessed from the Run SQL window. Click on the History icon, File > SQL History or Ctrl+H.

This shows you all the SQL statements you have run. The following information is shown:

Click on a row to see the full details of the query at the bottom part of the window – this gives the full text of the query and / or error message. The SQL text and result boxes can be resized, in case you need a larger box to see the full text.

You can change the order of the columns in the view (drag and drop the column headers). This column order is remembered between AQT sessions.

Viewing saved results

If your Query Results were saved in the Data Display window then a Table icon will be shown in the Saved column. Click on this icon to open the saved query results in a Data Display window.

Run From

You can run SQL from a number of places in AQT. By default, only SQL run from the Run SQL window is recorded in the SQL History. However, in Options > History you can specify to include SQL run:

The menu item Run From allows you to specify which of these SQL statements are shown in the History display.

History Files

Information is (by default) written to aqt_history.txt in your default directory. You can change the directory where the history file(s) are written with Options > File Locations.

AQT holds SQL history indefinitely. If you history file becomes very large it can take a while to open the SQL History window.

If this happens, you should do one of the following:

If you have multiple History files, you can open a particular one with File > Open.

When are history records written?

History records are written to disk as soon as a query is run.

AQT writes a maximum of 20,000 bytes of an SQL statement and 1000 bytes of the result message to the history record. If you have a very large SQL statement you may notice that it is truncated when you retrieve it from the History. In this case you should save the SQL statement to disk rather than relying on the History to "save" it.

History and Queries

When your SQL statement is a saved-query (eg. is SQL you have saved or retrieved from disk), the information on the query filename is recorded with the history record. When you click on the SQL in the history grid, the information in the status bar (at the bottom of the window) will tell you the name of this saved query.

When you retrieve the SQL from the History, AQT will associate the query with your SQL:

Database

When you retrieve some SQL, AQT will not change the database in the Run SQL window to the database in the history record.

However if you use Retrieve into new Window, AQT will set the database in this new Run SQL window to the database in the History record.

Procedure History

AQT also records the running of Stored Procedures from the Run Procedure window. The history entries for these are recorded in file aqt_prochistory.txt. These history records also includes the parameters passed to the stored procedure; this can be useful when rerunnng a procedure run earlier.

Many of the considerations of these history records are the same as for the SQL History.

Audit Feature

Note that in addition to the SQL History feature, there is also Audit Feature. While this records similar information, the audit feature has a number of different options more oriented to long-term recording of update (non query) activity.