CONVERT command

The CONVERT command converts a QBE query to an SQL query.

If you specify CONVERT ?, the prompt panel shown in the following figure displays. You can complete the command on the prompt panel.

Figure 1. The CONVERT Command Prompt panel
                      CONVERT Command Prompt
type    ===> QUERY
 
name    ===>
             To convert an object from temporary storage, enter QUERY
             as its type.
 
             To convert an object from the database, enter its name (and
             optionally its type).
TARGET  ===> QUERY
             You can type QUERY to place the SQL query text on the SQL
             Query panel, or VARS to place it in the global variable pool.
             If you specify no target, the default is QUERY.
CONFIRM ===> YES
             Display the Confirmation panel before converting the current
             query to the SQL Query panel.  YES or NO.
 
             Press Enter to execute the command from this panel.
 
13=Help     15=End
Please follow the directions on the Command Prompt panel.
Command ===>
If your query contains substitution variables, and you do not provide values for them on your CONVERT command, a prompt panel displays. You can use this panel to supply the values for the variables. For example, assume that you write the following query, and save it as THISONE:
Q.STAFF | NAME      | DEPT   | JOB   | COMM       |
--------+-----------+--------+-------+------------|
        | P. AO.    | &DEPT  | P.    | P.         |
Now, suppose that you want to convert it to SQL, but specify only:
CONVERT THISONE

The prompt panel shown in the following figure displays:

Figure 2. Prompt panel that displays when you convert a query with substitution variables
            CONVERT Command Prompt -- Values of Variables
 
Your CONVERT command converts a query with variables that need values.
Fill in a value after the arrow for each variable named below:
 
 
&DEPT              ===>
                   ===>
                   ===>
                   ===>
                   ===>
                   ===>
                   ===>
                   ===>
                   ===>
                   ===>
 
Then press Enter to execute the command from this panel.
 
 
 
13=Help     15=End
Please give a value for each variable name.
Command ===>
When you enter the department number (84), the following SQL query displays:
SELECT "NAME", "JOB", "COMM"
FROM "Q"."STAFF"
WHERE ("DEPT" = 84)
ORDER BY 0000001

The CONVERT command does not operate on a QBE query at a remote location.

A single QBE insert or delete query can result in multiple SQL statements after the conversion. These statements are all placed on the SQL Query panel. However, all of the statements after the first are turned into query comments (each line is preceded by two hyphens). Use the Delete key to remove the hyphens from any statements that you want to run. You must place a semicolon at the end of every SQL statement except the last. The DSQEC_RUN_MQ global variable controls support for multi-statement queries.