You can run a saved query, or write and run a new one. You can also run a query without opening it, using the default options.
To run a query:
1. In the Queries branch of the desired connection in the DB2 Web Query navigation tree, click the query you want to run.
The Queries menu appears.
2. From the drop-down menu, select Open.
The Prepare Query page appears, and the SQL statement is shown.
Note: If you do not have read permission for the selected query, DB2 Web Query attempts to run the query rather than open it if you have run permission.
3. In the Settings section, select your Auto-Commit preference. The Auto-Commit preference determines when your changes are committed to the database
· Select Off to prevent your changes from being automatically committed to the database. When this option is selected, commits will be made to the database manually.
Note: If you select not to have your changes automatically committed, your database will be left in an uncommitted state. This can cause problems.
· Select When Finished to have your changes committed to the database after all SQL statements have been run.
· Select After Each Statement to have your changes committed to the database after each SQL statement is run.
4. In the Result Name field, type the name that you want to use for the results set.
Tip: DB2 Web Query provides a default results set name. You can replace this name with one that you prefer.
5. In the Max Rows field, enter the maximum number of rows to return in the results set.
Tip: To return all rows to the results set, enter "0" in the Max Rows field.
6. In the Timeout field, enter a timeout limit.
7. If you have SQL\PA installed on you system and your query has not been analyzed by SQL/PA, "Not Analyzed" will appear next to SQL/PA in the SQL/PA section. To analyze your query with SQL/PA, click Analyze in the SQL/PA section of the Settings section. SQL/PA analyzes one statement at a time. Therefore, if you have more than one SQL statement embedded in your query, you will see results in a cumulative format. To set your SQL/PA analysis options, click Analyze options.
Note: If you do not have SQL/PA installed, "Not Installed" will appear next to SQL/PA in the SQL/PA section.
8. Optional: Click Edit to edit the SQL query.
9. If the query contains variables, click each variable that is displayed in the Parsed Query section to define its value.
Enter the value of the variable or select a value from the dropdown menu, if available. Select Use to substitute the value specified for only that instance of the variable name. Select All References to substitute the value specified for every instance of that variable name in the query. Select Ignore to treat the variable as a string.
Tip: When you click a lookup variable, a dropdown menu appears from which you can select a value for the variable. If the variable has multiple selection defined for it, you may be able to select multiple values for the variable by holding down the Control key.
10. To run the query, click Next.
Note: DB2 Web Query does not validate SQL. Be certain to use correct SQL syntax, table names, and column names when writing your query.
DB2 Web Query runs the query, and displays the Query Data page. You can now view the message page, and specify how to display or export the query results.