SQL Test

Use the Test SQL dialog box to test SQL queries on the tables you created for your host application model. This allows you to debug your table and procedure definitions before deploying your model. Before you can run an SQL test on a host application model, you must first create tables derived from the model that contain the data that you want to query.

When you test an SQL query, you simply enter a supported SQL-92 statement in the SQL statement box of the Test SQL dialog box and the Design Tool returns the results.

For a basic introduction, see the SQL example in the tutorial.

Tip: If you're using SQL, note the Tables dialog box setting for Allow SQL SELECT to return a subset of columns.

Executing an SQL Test

To test an SQL query on your model tables, you must either be connected to the host and have access to the application the model is based on, or you must load the model in the Host Emulator and connect to it.

To run a test SQL query on a table, follow these steps:

  1. Load the host application model containing the table to test into the Design Tool.
  2. Select SQL Test from the Debug menu to display the SQL Test dialog box.
  3. Connect to the host.
  4. In the SQL statement box, type a supported SQL statement.
  5. Click Resolve. The Design Tool determines the procedure or procedures that could be used to satisfy the query you entered and display them in the Procedures box.
  6. Click Execute.
    The Design Tool executes the procedure or procedures and displays the output in the Output recordset dialog box. If the Terminal window is visible, you will see the Design Tool navigate to the appropriate host screen while it fulfills the SQL query.
    Note: The total record count is displayed with the output recordset results. You can limit the number of results for your test. Type in a number for Limit results to <x> records.
  7. Click Copy to copy the results to the Clipboard. This is handy if you need to evaluate and compare results from multiple SQL queries.
  8. Click Reset to perform another test or Close to close the Test SQL dialog box.

Debugging a Procedure

If you experience problems with a procedure used to satisfy an SQL query or you want to fully investigate the behavior of a procedure, you can debug it in the Debug Procedure dialog box.

To debug a procedure

  1. In the SQL statement box, type a supported SQL statement.
  2. Click Resolve.
    The Design Tool determines the procedure or procedures that could be used to satisfy the query you entered and display them in the Procedures box.
  3. Click Debug.
    The procedure or procedures display in the Debug Procedure dialog box.
Related Topics
Bullet Debugging procedures
Bullet SQL overview