Creating SQL Queries

For ODBC, Native Database, and certain Adapter connections, the Custom Query option allows you create a SQL query to, for example, select a subset of rows or columns in a table, or join multiple tables.

Source queries support

To Create A SQL Query

  1. In the Workbench, click Source > Configure. The Configure Source dialog box appears.
  2. Select the Custom Query option.
  3. Do one of the following:
  4. If you want to include a system variable or a user variable, click User Variables.
  5. If you have a saved query, click Open Query, select a query file, and click Open. If you select Yes when prompted to overwrite the existing query, the current query is replaced with the query in the file you open.
  6. If you have created a query that you want to reuse, click Save Query, specify where to save the file, and click Save.
  7. If you want to save a comment with the query, click Comment, type a meaningful comment, and click OK.
  8. If you want to test the query for syntax errors and display the execution time. click Test/Requery. The correct SQL statement syntax depends on the database driver you are using.

    Warning: Important! When you click Test/Requery, the query is executed. If the query includes update or delete statements,, your data is affected.

The result set from your SQL query displays in the Source pane of the main window.

Note: If your adapter does not support SQL syntax queries, you may be able to create a Insight Custom Query.

For information about creating SQL queries with Unicode data, see Unicode-compliant SQL queries

See also

Configuring the Source

Creating a SQL Query with Unicode data

Using Scalar Functions in Lookup Links

Using Source Expressions

Using System Variables

Managing User Variables