Previous Topic

Next Topic

Book Contents

Book Index

Other options in the Run SQL window

Display options

You can change the font used in the text box with Edit > Change Font

You can change the case of the selected text with Edit > Change Case

Editing functions

You can right-click the text-box to get a drop-down list of the Edit menu items.

You can Comment or Un-Comment a block of text with Edit > Comment Text and Edit > UnComment Text, or the Comment/UnComment icons.

You can Find and Replace text with Edit > Find and Edit > Replace, or use the Find icon.

Keyword management

You can add or remove entries from the Keywords and Operators listboxes. This is useful if there is an SQL keyword or phrase you use frequently. The keywords are held in file sqlkeywords.txt (in your AQT directory). You can edit this file to change the entries that appear in the listboxes.

You can edit this file by right-clicking the listbox and selecting Edit Keywords. If you have changed the keywords outside the control of AQT, Reload Keywords will reload the listboxes from the keywords file.

Line Numbers

You can have line numbers on your text by selecting View > Line Numbers

Line Wrap

You can specify whether text is wrapped with View > Line Wrap (Ctrl+W).

Bookmarks

The edit control supports the use of bookmarks. This makes it easy to find your way around a large script.

Right to Left Mode

You can switch your editor into Right to Left mode by selecting Edit > Right-to-Left mode.

Moving around your SQL

The following keys are useful to move through your SQL.

Find Bracket

This function is useful if your SQL has many indented levels of brackets. Position the cursor at a bracket and hit Edit > Find Matching Bracket (or F12)

Select within Brackets

Edit > Select within brackets (or F11), will select the text between the brackets containing the cursor. This can be useful for selecting and running a sub-select.

Send query result to SQL window

You can use Export > Export to SQL Window to send the query result back to the SQL Window. This is useful if you are running an SQL statement that is generating SQL statements.

Format SQL

You can format an SQL statement by clicking on Edit > Format SQL. This will reformat your SQL in a layout which is more easily read.

Insert statements will be formatted in a way which makes it easy to match the insert-value with the column being inserted; if the insert statement has a column list, the column name will be given (preceded by the comment indicator --) to the right if the column value. This syntax may not be valid for many databases, for which the comment indicator can only be given at the start of a line. However such insert statements will run OK within AQT as long as Options > Run SQL > Remove Comments from SQL is selected (by default it will be).

Both Format SQL and Unformat SQL will replace x'A0' characters with spaces. x'A0' is a "non-breaking space" that can appear in your SQL if you have pasted it from an email.

By default, the comma will be placed after the column name. To have it placed before the column name, specify Options > Run SQL > Format SQL places comma before column name.

Unformat SQL

You can unformat your SQL by clicking on Edit > Unformat SQL. This will remove all linebreaks and extra spaces from your SQL.

Wrap to 60 chars

This will split your SQL into multiple lines, with each line a maximum of 60 characters.

This function may not work if you have text literals greater than 60 characters (AQT will not split these) or have text literals which span lines.

Rewrite SQL

This is a more comprehensive reformat than Format SQL. AQT will "interpret" your SQL then rewrite it. The rules for how it will rewrite your SQL are specified in the Query Builder options.

This function can be used to:

This function works by importing the SQL into the Query Builder then generating the SQL from the Query Builder. The Query Builder can have difficulty with some complex queries, so this function can generate incorrect SQL in some cases. Use with a degree of caution.

Remove Invalid Characters

This option is useful if you have pasted a query from an email or from Microsoft Word. In these cases, there can be invalid characters in the SQL that can prevent it from running. In addition Word can use special characters for start and end double-quote, which are also not valid in SQL.

Using Edit > Remove Invalid Characters will correct both these problems.

Copy as RTF

This option will copy your SQL text in rich-text format. This can then be used for pasting the SQL into Microsoft Word or similar editor; the colors and other text effects will be copied with the SQL.

Column Guides

Column Guides are vertical bar in the Run SQL window, and are useful for lining text up in a particular column positions.

The positions of the Column Guides is specified in Options > Syntax Highlighting.

Zoom in/out

You can make the text smaller / bigger with Editor > Zoom in/out, or Ctrl + Up/Down.

Change Line Spacing

The default Line Spacing is given in Options > Syntax Highlighting > Line Spacing.

Alternatively you can change it in an SQL window with Editor > Increase/Decrease Line Spacing or Alt + Up/Down.

Block Selection

You can use Block Selection with Editor > Use block selection. When this is specified, text in a rectangular area is selected.

blockselection

Visual Where

You can display Visual Where for your query with View > Visual Where (Ctrl+Shift+W). This displays your query in a visual format, which makes it easier to understand.