Using a Script to Query the Database

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Tutorials > "ZooDB" Database > Querying the Database >

Using a Script to Query the Database

The SQL file animalType_query.sql that you have added to your database project in one of the previous sections of this tutorial contains a script that uses targets to output the two queries it is composed of to two separate Result tabs and assign a name to each tab. This way, you can execute the script with a single mouse click and have the results displayed in different Result windows. For more information, see Naming Result Tabs.

 

 

To query the database using the script animalType_queries.sql:

1.Make sure that the "ZooDBConnect" connection is active.
2.Click the Project tab.
3.In the SQL folder, double-click the file animalType_queries.sql. The file opens in an SQL Editor window.

sql_animalType-queries

4.In the Properties window, make sure that either "Semicolons" or "SQL Grammar" is selected in the Group statements for execution with drop-down list.

tab_properties-animalType_queries

5.Click the Execute ic_execute-sql button or press F5. The results of the two queries appear in separate tabbed windows that use the corresponding target names as tab text.

sql_edit_w_targets

If you do not get separate named result tabs as depicted above, switch the Show multiple results stacked ic_result-tabs option off in the SQL Editor toolbar.


© 2019 Altova GmbH