Running Multiple Named Queries
Whenever you run a query that returns some result from the database, the data is loaded in the Result window, for example:
In the example above, the name of the Result window is Result1. This might not be informative enough when you work with multiple queries in the same project. To make the results more informative, it is possible to run multiple queries in the same script and display the results as separate named Result windows. For example, you may have one query that selects data from the tblAnimalCategories table and another one that selects data from tblAnimalTypes table. You can add both to the same SQL script and display their returned result sets separately. The name of each Result window is configurable.
To run multiple named queries:
1.Open the "ZooDB" project created previously and double-click the ZooDBConnect data source to connect to it.
2.In the "SQL" folder, double-click the file animalType_queries.sql. The file opens in an SQL Editor window. As shown below, it contains two SELECT queries. Importantly, each query starts with a comment like --target: <tableName>. You can easily create such comments either by typing them manually, or by clicking the Define Target name toolbar button.
3.In the Properties window, make sure that either "Semicolons" or "SQL Grammar" is selected in the Group statements for execution with list.
4.Click the Execute button or press F5.
The results of the two queries now appear in separate tabbed windows. As shown below, the name of each tab corresponds to the --target names that were set previously.
You can also stack all the result windows, for example:
To stack all windows, click the Show multiple results stacked option in the SQL Editor toolbar.