ToadDataPoint 5.3.x UserGuide
ToadDataPoint 5.3.x UserGuide
ToadDataPoint 5.3.x UserGuide
User Guide
Copyright
Copyright 2
Contents 3
Introduction 6
About Toad Data Point 6
Best Practices 7
Understand Toad's Workflow 8
Connect 9
Create ODBC Connections 9
Tips for Working with ODBC Connections 10
ODBC Features 11
Create Oracle Connections 11
Client Connection or Direct Connection 11
Configure the Oracle Instant Client 12
Create an Oracle Connection 12
Create SQL Server and SQL Azure Connections 13
Understand Toad Connections 15
Toad Open Connections 15
Sharing a Connection Among Windows 16
Troubleshoot SQL Server® Issues 16
Connection Issues 16
Understand 19
Determine the Best Method to Locate Objects 19
Object Explorer 19
Filter Databases and Objects 20
Types of Filters 20
Before Creating a Filter 21
Create Filters 21
Use Filters 22
Import/Export Filters 23
Tutorial: Understand a Table Using the Database Explorer 23
Search for Objects 25
Tutorial: Create a Database Diagram to Use as a Query Template 26
Browse Data in Related Tables 28
Query 30
Tutorial: Visually Build a Query 30
Create Cross-Connection Queries 32
Considerations and Limitations of Cross-Connection Queries 33
Report 49
Tutorial: Create a Toad Data Report 49
Step 1: Run the Toad Data Report Wizard 49
Step 2: Update Fields 50
Step 3: Use Styles to Format the Report Appearance 50
Step 4: Update Bands and Add Controls 52
Manage Reports 53
About Managing Reports 53
DB2 Reports 54
MySQL Reports 56
ODBC Reports 56
Oracle Reports 56
SQL Server Reports 58
Publish and Share Reports 60
Automate 61
Getting Started with Automation 61
Introduction 61
The Automation Window 62
Create a Basic Script 64
Test and Run Your Script 65
Schedule Your Script 66
Automate Exporting to Excel Reports 67
Introduction 67
Create a Simple Excel Report 67
Create a Multi-Page Excel Report Using One Query 69
Create a Multi-Page Excel Report Using Multiple Queries 69
Schedule A Script 70
Automate Tasks 70
Use Database Automation Activities 74
Use File Automation Activities 81
Use System Automation Activities 85
Using Variables in Automation 91
How to Create Variables 91
How to Use Variables 92
About Us 97
Contact Quest 97
Technical Support Resources 97
Index 98
Toad® Data Point is a multi-platform database query tool built for anyone who needs to access data, understand
data relationships, and quickly produce reports.
With Toad Data Point, you can:
l Connect to almost any database or ODBC data source (see the Release Notes for a list of tested ODBC
connections)
l Write SQL queries and join data across all platforms
l Automate and schedule frequent and repetitive tasks
l Streamline data collection
l Collaborate with team members
l Export data in a variety of file formats
Toad Data Point provides a full-featured Database Explorer, Query Builder, and Editor for the following
databases:
l Oracle®
l Teradata®
l MySQL
Toad Data Point also provides querying and reporting functionality via the following provider types:
l ODBC
l Business Intelligence and NoSQL data sources
l Microsoft® Excel®
l Microsoft Access®
ODBC Connections
The purpose of the ODBC provider is to offer basic connection and querying capabilities to any database that
supports an ODBC 3.0 or later driver. For a list of databases tested with the ODBC provider, see the System
Requirements in the Release Notes. This form of connectivity allows connections to databases such as
Netezza, IBM iSeries, Ingres, and Vertica™. Because this form of connectivity is generic, it is not full-featured
and may not be as robust as the fully-exploited providers for the other databases.
Business Oracle Business Intelligence Enterprise Edition (OBIEE), SAP Business Objects™, Salesforce®,
Intelligence Microsoft SQL Server Analysis Services, Google Analytics™, OData, and SharePoint®
NoSQL Azure Table Services, Cassandra™, Cloudera Impala, DynamoDB, HBASE™, Hive™,
MongoDB™
Best Practices
Toad provides tools that help you succeed in your query and reporting goals. Many of these tools are
considered Best Practices and are beneficial for individual users as well as managers. The following table
describes the benefits of using Toad to improve Best Practices:
4. To create a data source to use in this connection, click in the Data Source Name field. Then click
Add.
5. Select an ODBC driver from the list, and click Finish.
Note: If creating an Oracle ODBC connection, select the ODBC driver provided by Oracle. The Microsoft
ODBC for Oracle driver has less functionality than the driver provided by Oracle.
6. Specify the configuration properties required for the database in the Windows configuration dialog.
Notes:
l If you have an Oracle database with Unicode data, make sure to select Force SQL_WCHAR
Support on the Workarounds tab of the windows Oracle ODBC Configuration dialog. If you do
not, you will not be able to see the data.
l If creating a MySQL ODBC connection to use in a cross-connection query, you must specify a
database in the Windows MySQL ODBC Configuration dialog.
7. Specify the connection properties in the Create New Connection dialog. Review the following for
additional information:
8. Click Connect to connect immediately while saving the connection information. Optionally, click Save to
save the connection without connecting.
Tip: Connections are stored in the connections.xml file and can be found by clicking the Application Data
Directory link in Help | About.
Click here to view a video about creating connections in Toad Data Point
5. To use the Oracle Instant Client connection in a cross-connection query, you must also install an
Oracle ODBC driver. (While the Oracle Client full install includes an ODBC driver, the Oracle Instant
Client does not.)
Note: You cannot use an Oracle Direct Connection in a cross-connection query.
4. Click Connect to connect immediately while saving the connection information. Optionally, click Save to
save the connection without connecting.
Note: Go to Tools | Options | Database | Oracle to specify default options to use in Oracle connections.
Tip: Connections are stored in the connections.xml file and can be found by clicking the Application Data
Directory link in Help | About.
2. Select Microsoft SQL Server or Microsoft SQL Azure from the Group list box.
3. Review the following for additional information:
4. Click Connect to save the connection and immediately connect to the database.
or
Click Save to save the connection without connecting to the database.
Tip: Connections are stored in the connections.xml file and can be found by clicking the Application Data
Directory link in Help | About.
1. Click .
If the single connection is in use when Toad attempts to execute it, the following occurs:
l (DB2 and Oracle only) If your database supports executing multiple queries simultaneously on a
shared connection, the query is placed in a queue and executes as soon as the current operation
completes.
l If your database does not support executing multiple queries on a shared connection, a dialog
prompts you to either permanently associate the window with a new database connection, cancel
the previous operation, or add the query to a queue until the current operation completes, and
the execute it. If you place multiple queries in the queue, each one executes in the order that it
was added to the queue.
Note: Although you can share a database connection, any commits apply to the selected window only.
Connection Issues
Review the following solutions to help troubleshoot SQL Server connection issues in Toad.
2. Specify the location for the new install's InitialSqlServer.Sql file in the
Run Script on new connection field.
By default, this file is located in the following directory:
C:\Program Files\Quest Software\Toad Data Point version
\Templates\Scripts
Note: Clicking may result in a "Path not found error". If you receive this
error, manually enter the location in the field.
Cannot establish Named Pipes If you are trying to connect to the server using Named Pipes, "Poll service
connection status in connection list" option should be cleared.
Solution:
1. Open the options page under Tools | Options | Database | General.
2. Clear Poll service status in connection list checkbox.
Cannot establish Azure Failing to establish Azure connection may indicate that your IP address is
connection restricted from having access to the Azure server.
Solutions:
1. Select Tools | Cloud Computing | SQL Azure Portal to login to
Azure Portal.
Object Explorer
You can view database objects for the current connection with the Object Explorer. This feature is useful for
dragging and dropping database objects into an open Editor, Query Builder, or other document window. Right-
click the objects in the Object Explorer to access additional features such as multiple tasks and actions.
Schema (first field) Select the schema you want to view. You can filter the list of schemas that
display. See "Filter Databases and Objects" on page 20 for more information.
Object Filter (second You can quickly set a filter in this field. To do so, enter a name or partial
field) name of an object and press ENTER. Any advanced object filters you set
display in this field.
You can also perform advanced filtering based on case sensitivity, statistics,
or other options. See "Filter Databases and Objects" on page 20 for more
information.
Tip: You can enable an option to filter using regular expressions in Tools
| Options | Explorer | General.
Note: For tables and views, the columns, data types, and comments display at the bottom of this
window.
l To navigate to a previously selected object, click . You can also click to move to the next
selected object.
l To locate objects including procedures, functions, views, variable names and comments in an object's
source code, use Object Search. See "Search for Objects" on page 25 for more information.
l To use a different method to select objects such as tabs, drop-downs, or a tree view, click .
l To generate reports, export data, create SQL statements, or send objects to the Project Manager, SQL
Modeler, or Master Detail windows, right-click the objects and select an option.
l To open the Background Processes window and cancel a query, click the progress bar at the bottom of
the window.
Types of Filters
You can create a Quick filter by entering a search string in the object filter field. You can also use the Filter
dialog (click ) to choose additional filter options. If you use the Filter dialog, you can also name and save
your filter.
Quick (unnamed) Can be used to quickly filter objects Applies to the current schema (or to
for a single connection or schema. objects in the current schema) only.
Create a Quick filter by entering a Once applied, a Quick filter is in
search string in the object filter field. effect on that connection when you
reconnect or relaunch Toad.
Because Quick filters are not
named, they cannot be applied to
other connections by selecting from
the filter list. You must recreate the
Quick filter for each
connection/schema.
Detailed (unnamed) Use like a Quick filter, but add more -- same behavior as a Quick filter --
detail by using the Filter dialog to
enter filter criteria.
Use this method to create an
unnamed database filter.
Named Create and save named filters to Once applied, a Named filter is in
reuse and to apply to other effect when you reconnect or
connections of the same data source relaunch Toad.
type. Can be re-used on other
connections of the same data
source type (DBMS).
Note: If you rename a table that has a filter defined, it results in an orphaned filter. Orphaned filters are
automatically removed unless you used a tool other than Toad to remove them.
Create Filters
To create a Quick filter (objects only)
l Enter a search string to use for filtering in the object filter field (below the database field) in the
Object Explorer.
Note: As you enter a search string, the currently specified Search Condition displays in a blue banner
below the object filter field. This Search Condition will be used in your filter. To change the Search
Condition, click and select a different one from the Search Condition drop-down.
1. Click beside the database or object filter fields in the Object Explorer.
2. Specify criteria for the filter in the Properties tab. Review the following for additional information:
Search String Enter a text string and search characters to use for filtering.
Search Condition Select a search type to use in this filter.
Note: You can set a default value for this field in Tools | Options |
Explorer | General. If you don't specify a default value in Options, this
field defaults to the search type you specified the last time you created or
modified a filter (includes previous sessions).
3. To create custom SQL, select the SQL tab and then select the Enable custom SQL option. Modify the
existing SQL. (The existing SQL reflects the criteria you specified in the Properties tab).
4. Select the Preview tab to review the list of databases or objects that are selected based on your
filter criteria.
2. Enter a name for the filter and click . Creating a name for the filter allows you to use it on other
database connections.
Use Filters
To use Named filters
l To apply a Named filter, click the down-arrow beside and select the filter from the drop-down list.
l To clear a Named filter, click the down-arrow beside and select <None>.
A filter is applied.
Import/Export Filters
You can export all named filters and you can export all filters defined for the current connection.
l To export Named filters or all filters defined for the current connection, click the down-arrow beside
in the database field and select Export Filters.
l To import filters previously exported from Toad, click the down-arrow beside in the database field
and select Import Filters. Browse to and select the filter file (.tfp) to import.
Tip: Click in the Database Explorer (Viewer) toolbar to clear all database, object, and data filters.
Note: This topic focuses on information that may be unfamiliar to you. It does not include all step and field
descriptions.
The only row that now displays is the one with Acton as the last name.
6. Click to the right of the LAST_NAME column again and select All to clear the filter.
7. Click the CONTACT_ID column to sort the rows in ascending or descending order.
The filter string displays at the bottom on the grid. Click to remove the filter.
10. Select a row of data in the grid. Notice that the row number changes in the bottom right of the status bar:
11. Under the SEX column, right-click the area below the last row in the grid that says "Right-click to add
column totals" and select Count. The total number of rows that have either a M or F value display.
12. Click to the right of the SEX column and select F. The count value updates based on the new filter.
13. Click to the right of the SEX column again and select All to clear the filter.
Tips:
l To remove objects from the search results, right-click the objects in the data grid and select Remove
Items. This is useful if you want to narrow the list of results to relevant objects.This does not remove the
objects from your database.
l To create a DDL script from the search results, right-click the data grid and select Create DDL Script.
You can then paste the results into the Editor.
l To perform any actions available for the object, such as creating, altering, dropping, exporting, and
generating reports or SQL, right-click the results in the data grid and select an option.
c. Provide the location of the Network Share and Object Annotation Cache settings to colleagues
who need to use this diagram.
2. Drag one or more tables from the Object Explorer, Object Search, or Project Manager window to
the Diagram pane at the top of the Master Detail Browser. Press CTRL+click to select multiple
tables at once.
Notes:
l A line between tables indicates any existing relationships between the selected tables.
l At least one parent table (table without any join arrows pointing to it) must be added to the
window or an error message displays when returning results.
3. Join Columns.
4. Select the checkbox beside each column you want to include.
Note: Any columns included in a join are automatically included in the results.
5. Click (F9) to retrieve data for the parent table initially. To view data in a child table, click + to the left
of each row.
or
Click to retrieve data in the parent and child tables. If there is more than one child table, a tab
displays for each child table.
l Select the parent table from the drop-down list in the toolbar to view data for a parent table if there are
multiple parent tables.
l Click X on the table you want to remove in the Diagram pane to remove a table and any conditions (e.g.,
join, where clause) associated with the table.
Scenario
Your company wants to improve its global sales, starting with countries where it has
a customer base but generally low sales. You need to create a query that identifies
countries with less than $500,000 in sales for each of the last four fiscal years.
Note: This scenario uses the SH (Sales History) sample schema that comes with
Oracle 10g so you can follow the procedure.
Tips:
l Select Query Builder | Arrange Tables (ALT+Q+A) to have Toad arrange the tables in the
Diagram pane.
l You can press CTRL and select a table, and then drag the table into the Editor pane. Click the list
to create statements.
l You can also press CTRL and select all of the tables in the Object Explorer, and then drag them
into the Diagram pane. Toad automatically arranges the tables.
4. Add the following columns to the query by clicking each column:
Table Column
COUNTRIES COUNTRY_NAME
TIMES FISCAL_YEAR
SALES AMOUNT_SOLD
Tips:
l To view details for a table in the Diagram, click (F4). If a table is not selected, details for the
last selected table display.
5. Complete the following steps to group the data and sum the sales:
a. Select the Group By field in the COUNTRY_NAME column, and then click +. The Group By field
is in the Criteria pane, which is below the Diagram pane.
b. Select the Group By field in the FISCAL_YEAR column, and then click +.
c. Select the Aggregate Function field in the AMOUNT_SOLD column and select Sum. This sums
all of the sales per fiscal year per country.
Note: If you select a group by clause or aggregate function for a column, the rest of the columns
in the query must also have a group by clause or aggregate function.
6. Complete the following steps to select the fiscal year range:
a. Select the Where Condition field in the FISCAL_YEAR column and click . The Where
Condition window displays.
a. Select the Having Condition field in the AMOUNT_SOLD column and click . The Having
Condition window displays.
b. On the Form tab, select < in the Operators field.
c. Select Sum in the Aggregate field.
d. Enter 500000 in the Constant field and click OK.
8. Select Ascending in the Sort field of the COUNTRY_NAME and FISCAL_YEAR columns.
9. Click .
The query results display in the Results tab. See "View Result Sets" on page 43 for more information.
10. To save the query, right-click the Query Builder tab and select Save File.
You can save a query and any results sets in a Toad editor file (.tef). This file format is useful for building
scripts that have large result sets that you do not want to continue executing or for saving results when
you have not finished building a script.
Note: This feature is available in the Toad Data Point Professional Edition only.
Note: Review the "Considerations and Limitations of Cross-Connection Queries" section below.
Tips:
l In a cross-connection code completion list, the selected database displays a descriptive tooltip
containing database and connection information.
l Use the Database Diagram tool to create and save cross-connection relationships, and then send the
tables with their relationships already created to the Query Builder.
Consideration/Limitation Description
Performance concerns A cross-connection query may take longer to execute than a query against a
single database because result sets from each database are retrieved and
combined to generate a single result set.
In the Professional edition of Toad Data Point, the enhanced execution
engine utilizes several optimizing techniques to improve the performance of
cross-connection queries.
ODBC driver support An ODBC driver can be selected for a single connection through each
connection's Properties dialog or globally through Tools | Options |
Database.
Using an Oracle connection in To use an Oracle connection in a cross-connection query, you must install
a cross-connection query an Oracle ODBC driver.
Note: The Oracle Full Install client includes an ODBC driver. However, if
you are using the Oracle Instant client (which may not include an ODBC
driver), you may need to install an Oracle ODBC driver.
Oracle Direct Connection You cannot use an Oracle Direct Connection in a cross-connection query.
Using a Teradata connection To use a Teradata connection in a cross-connection query, you must install
in a cross-connection query a Teradata ODBC driver.
Using a MySQL ODBC To use a MySQL ODBC connection in a cross-connection query, you must
connection in a cross- specify a database for the connection.
connection query
General Description
Single statement support The Query Builder only supports one statement at a time. If you add multiple
statements to the Query tab, only the first statement is used. If you make any
changes to the statement on the Diagram tab, the other statements are lost.
Quote identifiers If you selected the Quote Identifiers checkbox in Tools | Options
| Database | General and generate a query from the Query Builder in SQL
Server, the query cannot be reverse engineered.
ODBC support You must use ANSI SQL for the query.
Excel support Copying a generated query and attempting to reverse engineer that query
results in an error. This issue occurs because the parser defaults to Oracle
syntax, which does not understand quotation marks for fully qualified object
names. To avoid this issue, clear the Use fully qualified object names and
Use fully qualified column names checkboxes in Tools | Options
| Database | Query Builder or manually edit the query.
Non-ANSI joins (Oracle When sending a query from the Editor to the Query Builder, Toad
only) automatically uses ANSI joins. If you use Where clause joins, click to
disable ANSI joins. This converts the statement to the correct join.
Where Condition Description
Where condition does not If you send a query that contains a Where condition from the editor to the
display in the Criteria grid Query Builder, it displays in a Global Where clause bubble on the Diagram
after sending it to the Query pane instead of in the Where Condition field in the Criteria grid.
Builder from the Editor You can double-click the Global Where Clause bubble in the Diagram pane
Click in the Query Builder to send a statement to the Editor. Skip the remaining steps and continue to
edit the query. See "About Editing SQL" on page 39 for more information.
Troubleshooting: If the query cannot be modeled in the Diagram tab, a message displays and the
statement opens in the Query tab. This usually occurs because the graphical diagram cannot support
some functionality in the statement. You can view an explanation for this in the Output window or by
hovering over the syntax with a red underline ( ) in the Query tab. To continue, correct the error and
Inserted lines
Use the toolbar in the lower-right corner of the Query tab to modify the color used for
each indicator.
Caution: If you manually enter or update the statement in the Query tab, you must click to model
the query in the Diagram tab. If you do not do this and make additional changes in the Diagram tab,
any changes you made in the Query tab are lost.
Tip: If you have multiple statements in the Editor and you want to send only one to the Query Builder, highlight
the statement, then right-click it and select Send to Query Builder.
To build a subquery
1. Connect to the Toad Sample (Access) database in the Navigation Manager.
2. Select Tools | Query Builder | Query Builder.
3. Drag the ADDRESS table to the Diagram pane.
4. Click these column names in the ADDRESS table to add the columns to the query:
l ADDRESS_ID
l REGION_ID
5. To add a subquery:
a. Select the Where field in the REGION_ID column and click . The Where Condition
editor displays.
b. Select the IN operator from the list, and then click Subquery.
d. Drag the REGION table to the Diagram pane and select the REGION_ID column.
e. Select the Where field in the REGION_ID column and click . In the Where Condition editor,
select the In comparison operator, select Constant, and select the values 1 and 2.
g. Click to execute the subquery. Select the Results tab to review the result set
for the subquery.
6. Click the Query node in the Queries pane to return to the main query window. A call-out in the main
query Diagram pane indicates that the statement contains a subquery and identifies the column it is on.
Hover over the call-out to view the subquery statement.
To edit SQL
1. Select Tools | Edit | SQL Editor.
Note: You can query the worksheet from the Editor by entering a dollar sign ($) followed by a cell range
to limit the results similar to the following statement:
Select * from (MyWorksheet$A1:C10)
You can also query the entire worksheet by entering a dollar sign ($) after the worksheet name;
however, this returns empty rows and columns in the worksheet.
2. Review the following to help enter SQL:
l Code completion
l Script Map
l Code regions
l Code snippets
l Toad views
l SQL recall
l Add/remove application code
l View Objects at Cursor
l Macros to record keystrokes
4. Right-click a block of code in the Editor to see additional actions available in the context menu. For
example, you can turn a line into comment, uppercase or lowercase it, surround with snippet, set
numbered bookmark, collapse or expand nodes, send to Query Builder and etc. You can also right-click
an object (e.g. a table) and manage it as if in the Object Explorer.
5. Hold Alt + left-click and drag to select vertical blocks of text in Editor.
6. Select the block of code in the Editor, and click to validate the syntax.
Note: Toad undoes any changes to the object and data in the database after executing the script (notice
that the Result Sets tab is empty). To modify the object and data, you need to execute the script.
8. Click to execute SQL on the current server or multiple servers at one time. In the Editor toolbar, the
execute SQL buttons are grouped under . The button will retain the function of the last execute
action for the active Editor window. If you switch to another Editor window, the button will change to
reflect the last action for that window.
9. Select the block of code in the Editor and click to create a stored procedure. Stored Procedure
creation dialog automatically recognizes procedure body and declared parameters.
Tips:
l Toad automatically saves a backup copy of any modified editor file in the Application Data Directory to
avoid losing your work. When you restart Toad after an unexpected close, Toad checks the timestamp on
the backup file against the original file, and opens the file that has the latest timestamp. The document
recovery option is in Tools | Options | Environment | General.
l You can save the current connection, SQL script, executed results, filters, and group execute
connections/results (if enabled) in a Toad editor file (.tef). This file format is useful for building scripts that
have large result sets that you do not want to continue executing or for saving results when you have not
finished building a script.
l Editor supports floating window mode.
l The script is automatically checked for syntax errors when executing current statement (F9), checking
syntax, changing database, or refreshing the Script Map. The syntax errors are listed in the Script
Results pane in the Messages tab.
l If you copy and paste a SQL statement from one editor window to another, Toad automatically rewrites
the statement to match the syntax of the connection for the second editor window.
Caution! If you have some global access keys assigned, make sure that Toad shortcut keys do not coincide
with them. When using such duplicating shortcut keys in Toad, the third party application commands,
assigned globally, will be performed instead of ones assigned by Toad.
Clipboard Description
CTRL+C Copies the selected text to the clipboard
CTRL+X Cuts the selected text for pasting in the clipboard
CTRL+V Pastes text from the clipboard
Code Completion Description
CTRL+PERIOD Displays code completion list
ENTER Selects an item and close the code completion list
CTRL+SPACE Selects an item without closing the code completion list
CTRL+<right arrow> Expands a node in the code completion list
CTRL+<left arrow> Collapses a node in the code completion list
Comment Description
CTRL+MINUS Comments the selected line
CTRL+SHIFT+MINUS Uncomments the selected line
Cursor Description
Troubleshoot Data
l If you cannot edit data, click the red icon in the lower left corner of the grid, and then click OK on the
window that displays. You do not need to edit fields in this window.
l By default, auto commit is enabled and any row changes you make are automatically submitted to the
database. You can disable this option in Tools | Options | Environment | Grid.
You can also save a result set and later use it as a historical comparison.
2. Review the differences.
Tips:
l To switch the contents of the left pane to the right pane, and the contents of the right pane to the
left, click .
l You can also open files to compare by clicking beside the drop-down list at the top
of each pane.
l You can show or hide tables that contain equal records, different records, etc., at any time using
the toolbar.
Tip: To refresh data in a linked query report, click in Excel's External Data toolbar. This executes
the underlying query for the report. See "Share Excel Linked Queries" on page 47 for more
information about creating and using linked queries.
Note: If the window containing data does not have the focus when you select a One Click Export option, the
following message displays: "Export did not find any results sets to process."
Tips:
l To specify a default export folder, go to Tools | Options | Environment | Export.
l To always open a Save File dialog when exporting using One Click Export, go to Tools | Options
| Environment | Export and select the option. This allows you to always customize the file name.
Scenario
You need to create an Excel linked query so that the Regional Sales Manager, can
track whether the Sales Representatives in his region meet their monthly and
quarterly goals. By providing a linked query, you only have to create the query once,
and then the Regional Sales Manager can refresh the data at any time to view the
latest sales information.
Report
Tutorial: Create a Toad Data Report
Use the Data Report Designer to design reports visually. Stored in .tdr files, data reports are "live" reports that
can be refreshed dynamically. What makes them dynamic is that they contain the underlying queries for report
data sets. Each time a data report is opened, its query runs and the latest data is retrieved. The dynamic nature of
data reports makes them ideal for distribution to users who need to see changes to data without waiting for sched-
uled updates or for new reports to be distributed.
Note: This procedure does not cover all of the possible steps of creating a data report. It only covers the steps
required to create a report for the scenario. See About Designing Toad Data Reports for more information.
Scenario
Your company wants to improve its global sales, starting with countries where it has a customer base but
averages low sales. You created a query that displays countries with less than $500,000 in sales per fiscal
year, but now you need to create a report to help represent and evaluate the results. The data should be
grouped per country and show the total and average sales for each country. In addition, you want the report
to look similar to the rest of the company's documents, which use specific colors and fonts.
Note: This scenario uses the data generated in Visually Build a Query.
4. Select COUNTRY_NAME and click , and then click Next. This groups the data by the country name so
that each country is listed as a heading and its sales per year display below it.
Tip: You can create a secondary group by selecting another column and clicking again. A secondary
group is not appropriate for this scenario, but it would be if the data included regions in each country or
fiscal quarters. You would need to make the region or fiscal quarter a secondary group for the data to be
organized appropriately.
5. Select the Sum and Avg checkboxes for the SUM(SALES.AMOUNT) row, and then click Next. These
options calculate the sum and average sales amount for each country.
Tip: The Outline and Align Left options are good choices if you grouped the data.
9. Click Preview to see what the report looks like in print. Previewing the report makes it easier to see how
the bands and their content display in the printable report.
3. Select the following fields one at a time and make them wide enough to see the full text: Sum (groupFoot-
erBand1), Average (groupFooterBand1), and Grand Total (reportFooterBand1).
4. Select the following fields one at a time and drag them to the one inch mark on the ruler: Sum, Average,
and Grand Total.
5. Right-click the COUNTRY NAME field (not the COUNTRY_NAME field on the right) in groupHeaderBand1
and select Delete.
Note: The COUNTRY NAME field is a label that precedes the COUNTRY_NAME field value. If you preview
the report before you delete the COUNTRY NAME field, the country displays as 'COUNTRY NAME Argen-
tina'. It is clear that Argentina is the country name, so this field is redundant.
6. Select the COUNTRY_NAME field and drag it to align with the report title.
7. Select the COUNTRY_NAME field and make it three inches wide to accommodate long country names.
c. Select Title.
d. Select the Foreground Color field, and then select MidnightBlue in the Web tab.
e. Select the Font field and click . The Font window displays.
2. Complete the following steps in the Styles Editor window to create and define four new styles:
a. Click four times in the Styles Editor window to create four new styles.
Name OddRow
Borders Bottom
Name EvenRow
Borders Bottom
Name TableHeading
Name CountryName
b. Select TableHeading in the Style field (under Styles) for the Fiscal Year and Sales Amount
fields in groupHeaderBand2.
d. Select the COUNTRY_NAME field in groupHeaderBand1 and then select CountryName in the Style
field.
2. Complete the following steps to add a line under the report title:
Tip: It is helpful to expand a band before adding controls to give you plenty of room in which to
work.
3. Select reportFooterBand1 and drag it down half an inch. This adds white space between the country
information.
4. Click Preview.
5. To save the report, right-click the Data Report Designer tab and select Save File.
Manage Reports
About Managing Reports
Use the Report Manager to create and organize data reports, add existing Toad or Excel reports, or generate
reports.
To create a report
1. Select Tools | Reports | Report Manager from the menu.
b. Right-click the folder where you want to add the report, and select Add Existing Report.
Tips:
l To add an existing Toad or Excel report to the Report Manager, right-click the Report Manager window and
select Add Existing Report.
l To send a Toad or Excel report via email or to a shared folder or other location, right-click the report, select
Send To, and then select an option.
l To share reports with other users, specify a shared network directory in Network Share Options (Tools |
Options | Environment | Network Share).
DB2 Reports
The following reports are available from the Reports Manager (Tools | Reports | Reports Manager).
Activity Lists and describes activity reports that the Activity Monitor for the current DB2 for LUW
database uses. This report also lists the switches required to gather data for a specific
activity report. Toad uses the AM_BASE_RPTS table function to generate this report.
ADMIN_LIST_HIST_ Displays information from the database history table for the DB2 for LUW database par-
V82 tition to which Toad is currently connected. Toad uses the ADMIN_LIST_HIST table func-
tion to generate this report.
Database Partitions Shows information about each database partition on the current DB2 for LUW database.
Toad uses the DB_PARTITIONS function to gather this information from db2nodes.cfg.
DB Manager Config Lists the database manager configuration parameters and their values defined for the
Info current DB2 for LUW database.
HEALTH_CONT_HI Shows the current "health" status of all containers that tablespaces in the current DB2
for LUW database use. Toad uses the HEALTH_CONT_HI table function to generate this
report.
HEALTH_CONT_HI_ Shows a "health" history for all containers that the tablespaces in the current DB2 for
HIS LUW database use. Toad uses the HEALTH_CONT_HI_HIS table function to generate this
report.
HEALTH_CONT_ Identifies the containers that tablespaces in the current DB2 for LUW database use and
INFO lists the highest current alert status for each container. Toad uses the HEALTH_CONT_
INFO table function to generate this report.
HEALTH_DB_HI Shows the "health" status of the current DB2 for LUW database, including its highest cur-
rent alert status. Toad uses the HEALTH_DB_HI table function to generate this report.
HEALTH_DB_HI_ Shows the "health" history of the current DB2 for LUW database. Toad uses the
HIS HEALTH_DB_HI_HIS table function to generate this report.
HEALTH_DB_HIC Shows the "health" status of objects in the current DB2 for LUW database. Toad uses the
HEALTH_DB_HIC table function to generate this report.s
HEALTH_DB_HIC_ Displays a "health" history for objects in the current DB2 for LUW database. Toad uses
HIS the HEALTH_DB_HIC_HIS table function to generate this report.
HEALTH_DB_INFO Shows the highest current alert status for the current DB2 for LUW database. Toad uses
the HEALTH_DB_INFO table function to generate this report.
HEALTH_DBM_HI Shows the "health" status for the current DB2 for LUW instance. Toad uses the HEALTH_
HEALTH_DBM_HI_ Shows a "health" history at the database manager level for the current DB2 for LUW
HIS instance. Toad uses the HEALTH_DBM_HI_HIS table function to generate this report.
HEALTH_DBM_INFO Shows the highest current alert status for the current DB2 for LUW instance. Toad uses
the HEALTH_DBM_INFO table function to generate this report.
HEALTH_TBS_HI Shows the "health" status of all tablespaces in the current DB2 for LUW database. Toad
uses the HEALTH_TBS_HI table function to generate this report.
HEALTH_TBS_HI_ Shows a "health" history for tablespace in the current DB2 for LUW database. Toad uses
HIS the HEALTH_TBS_HI_HIS table function to generate this report.
HEALTH_TBS_INFO Shows the highest current alert status for each tablespace in the current DB2 for LUW
database. Toad uses the HEALTH_TBS_INFO table function to generate this report.
Index Statistics Displays statistics for the indexes under the current schema for the DB2 for LUW data-
base and flags those indexes that need reorganization. Toad uses the REORGCHK_IX_
STATS procedure to generate this report.
Installed DB2 Lists the DB2 for LUW 9 products currently installed on your system. Toad uses the
Products ENV_GET_PROD_INFO table function to generate this report. Products can include the fol-
lowing: RTCL DB2 Run-Time Client CONSV DB2 Connect Server (any edition) CONPE DB2
Connect Personal Edition
Installed DB2 Lists the DB2 for LUW 8 products currently installed on your system. Toad uses the
Products_V82 ENV_GET_PROD_INFO table function to generate this report. Products can include the fol-
lowing:
l PE DB2—Personal Edition
l QP DB2—Query patroller
l WM DB2—Warehouse Manager
Instance Inform- Lists details about the current DB2 for LUW instance. Toad uses the ENV_GET_INST_
ation_V82 INFO table function to generate this report.
Recommendations Provides recommendations (in English) for the various activity reports that the activity
for Activity Reports monitor uses. Toad uses the AM_BASE_RPT_RECOMS table function to generate this
report.
SNAP_GET_ Displays information and statistics about each container that tablespaces in the current
CONTAINER _V82 DB2 for LUW 8 database use. To generate this report, Toad uses the SNAP_GET_
CONTAINER table function to retrieve information from the tablespace_container logical
data group.
SNAP_GET_DB_V82 Lists information and statistics captured for the current DB2 for LUW 8 database. To gen-
erate this report, Toad uses the SNAP_GET_DB table function to retrieve information
from the database and detail_log logical data groups.
SNAP_GET_DYN_ Lists statistics and information about the dynamic SQL statements executed against the
SQL_V82 current DB2 for LUW 8 database use. To generate this report, Toad uses the SNAP_GET_
DYN_SQL table function to retrieve information from the dynsql logical data group.
SNAP_GET_TAB_ Lists information and statistics about the tables in the current DB2 for LUW database 8.
V82 To generate the report, Toad uses the SNAP_GET_TAB table function to retrieve inform-
ation from the table logical data group.
SNAP_GET_TBSP_ Lists information and statistics for the database partitions that make up each tablespace
PART_V82 in the current DB2 for LUW 8 database. To generate this report, use the SNAP_GET_
TBSP_PART table function to retrieve information from the tablespace_nodeinfo logical
data group.
SNAP_GET_TBSP_ Lists information and statistics for each tablespace in the current DB2 for LUW 8 data-
V82 base. To generate the report, Toad uses the SNAP_GET_TBSP table function to retrieve
information from the tablespace logical data group.
SNAPSHOT_ Lists the agents working for the various applications connected to the current DB2 for
AGENT_V82 LUW 8 database. To generate the report, Toad uses the SNAPSHOT_AGENT function to
retrieve information from the application snapshot, especially from the agent logical
group.
System Inform- Displays information about the operating system in which the current DB2 for LUW 8
ation_V82 database operates and about the CPUs configured on this operating system. Toad uses
the ENV_GET_SYS_INFO table function to generate this report.
Table Statistics Displays statistics for the tables under the current schema in the DB2 for LUW database
Column View and flags those tables that need reorganization. Toad uses the REORGCHK_TB_STATS
procedure to generate this report.
Table Statistics Displays statistics for the tables under the current schema in the DB2 for LUW database
and flags those tables that need reorganization. Toad uses the REORGCHK_TB_STATS
procedure to generate this report.
MySQL Reports
The following reports are available from the Reports Manager (Tools | Reports | Reports Manager).
ODBC Reports
The following reports are available for the Toad Sample Database in the Reports Manager (Tools | Reports
| Reports Manager):
Customer orders Displays customer orders for contact IDs less than 10 from the Toad sample database. It
is an example of master detail display using a single result set.
Customer list Displays a list of customers from the Toad sample database.
Items to order Displays items in stock that have a quantity of less than 50 and should be reordered from
the Toad sample database.
Oracle Reports
The following reports are available from the Reports Manager (Tools | Reports | Reports Manager).
Cluster Reports
Clusters Displays cluster information, including the cluster type, definitions, storage parameters,
and affected tables.
Other Reports
Invalid objects Displays any invalid objects for the selected schema and includes a subtotal of all invalid
objects for that owner.
Loads into shared Displays packages that have been loaded five or more times, into the Oracle shared pool.
pool Note: You must have DBA privileges for this report.
Non-system objects Displays any objects in the SYSTEM tablespace that are not owned by SYSTEM.
in SYSTEM tables
Oracle initialization Displays the values for all parameters defined in the PFILE for the selected user.
parameters
Tablespaces near Displays tablespaces that over 90% full, and do not have the autoextend feature enabled.
capacity
Total shared pool Displays the number of times objects in the shared pool were reloaded.
reload stats Note: You must have DBA privileges for this report.
User hit ratios Displays the buffer cache hit ratio users and includes consistent gets, blocked gets, and
physical reads.
User resource Displays values for resource usage such as CPU used and SQL*Net roundtrips for each
usage user.
Sequence reports
Sequences Displays the sequences that are within 10% of the maximum value. Any sequences that
do not have a maximum value set, or those that cycle are excluded from the report.
Sequences near Displays the sequences that are within 10% of the maximum value. Any sequences that
max do not have a maximum value set, or those that cycle are excluded from the report.
Arguments of Displays any parameters required for the selected stored procedure.
stand-alone stored
programs
Object type bodies Displays the body or source code for a selected object.
Object types Displays the type of objects owned by a user, including whether the objects are valid
and when they were created or last modified.
Package bodies Displays the body or source code for a selected package
Package spe- Displays specifications for a selected package, including whether it is valid and when it
cifications was created or last modified.
Stand-alone stored Displays the source code for a stored program, including the type of program and the
programs last time DDL was generated.
Stored object with Displays a list of all stored programs including their source.
source
Stored procedures Displays the source for stored procedures for a selected owner.
Synonyms Displays information for each synonym, including the owner, table owner and name, and
the DB link.
Table Reports
Indexes Displays details for the index definition, storage parameters, and columns included in
the index.
Non-indexed tables Displays any tables that have not been indexed for the selected database.
Tables & columns Displays all columns for a selected table, including the maximum transactions, used/free
blocks, free lists and groups, min/max extents, and columns included in this index.
Tables & indexes Displays any indexes for a selected table, including the status, uniqueness, and columns
included in the index.
Trigger Reports
Triggers & columns Displays triggers for a selected table, including the trigger event, status, WHEN clause,
and columns associated with the trigger.
User-defined Reports
Sample Displays a sample user report based on a select * from dual query.
View Reports
Views & columns Displays all columns for a selected view, including the query and columns included in
the view.
DBA Reports
All jobs Displays all scheduled SQL Server jobs and the job owner, organized by server.
Backup history Displays the backup start date, type, and device used for the backup for a specified data-
base for a set number of days.
Backup status Displays the database name, date of the last backup, days since the last backup, and the
type of backup performed.
Current lock report Displays any locks on the server, including the database name, object or index name,
type of lock, resource, mode, and status.
Database con- Displays configuration options for each database on the specified server.
figuration options
Database settings Displays any common options and their values for all the databases on your server.
Database user Displays the user name, roles, objects, granted/denied status, and column permissions
details for each database.
Display errors Displays a log file without entries for log backups. This is useful when you have a num-
ber of log backup entries and you need to locate non-backup errors.
Drive space usage Displays space for all databases on the server, including free space, space used, max-
imum size, and growth type.
Foreign key Displays tables in the order you can either populate or delete from them without violating
sequence any foreign key constraints. Objects with the lowest wave number indicate that they can
be deleted with the fewest number of foreign key references. Objects with the highest
wave number should be populated first.
Index description (SQL Server 2000 only) Displays all indexes for the current database sorted by table.
Index information includes whether it is clustered, unique, index keys, and the index
size. run frequency, and the maximum duration.
Job details (SQL Server 2000 only) Displays all SQL Server jobs, including whether they are sched-
uled, enabled, start date and time,
Row count for tables Displays the number of rows for all tables on a server that contain a clustered index.
with clustered index
Total rows and Displays the total number of rows and space used for each table or view in the current
space used database, including the reserved rows, unused rows, and index size. This report is sor-
ted in descending order by reserved rows.
User permissions Displays users permissions, grouped by role name and object type.
Configuration change his- Displays a history of all sp_configure and Trace Flag Changes recorded by the
tory default trace.
Schema change history Displays a history of all committed DDL statement executions recorded by the
default trace.
Table Reports
Indexes Displays index information for a selected table, including whether the index is
clustered, unique, ignores duplicate keys, allows page/row locks, and a list of
indexed columns.
Non-indexed tables Displays any tables that have not been indexed for the selected database.
Table constraints Displays any check constraints for a selected table, including whether the con-
straint is enabled, valid data, and affected columns.
Table extended prop- Displays any extended properties for a selected table.
erties
Table relationships Displays any foreign key constraints for a selected table, including whether the con-
straint is enabled, referenced tables, and referenced keys.
Tables and columns Displays all columns for a selected table, including the data type, default value,
whether it allows null values, and for SQL Server 2005 any extended properties.
Tables and indexes Displays any indexes for a selected table, including the name, columns included in
the index, and whether it is unique or clustered.
Stored procedures Displays stored procedures for a selected database, including their status, status,
replication information, schema version, statistics, and procedure text.
l Email reports and files, including Database Diagrams, Query Builder queries, SQL scripts, and results for
reports, queries, and scripts.
l Share reports and files in a central location such as the Toad shared folder.
You can use the following methods to publish and share information:
Automation Drag the Send Email activity to the Automation workflow and attach files as
needed. The email is sent when the automation script executes.
Project Manager, Right-click a report or file and select Send To | Toad Shared. The file is
Reports Manager sent to the Toad shared folder specified in Tools | Options | Environment
| Network Share.
Automation Drag the Copy File activity to the Automation workflow. Specify the file to copy
or move and a destination folder. This can be any folder, including the Toad
shared folder, or a network folder. The file is copied or moved when the auto-
mation script executes.
Automation Drag the Zip File activity to the workflow. Add reports and files to the Zip file
and specify a file name with a .zip extension. The ZIP file can then be emailed
with the Send Email activity or copied with the Copy File activity.
Automation Drag the Publish Files activity to the Automation workflow. Add reports and
files created previously in the script or add other existing files.
Tips:
l To export a Toad report to a file that can be read by other applications, double-click a report in the Reports
Manager, click in the Report Preview window, select a file format, and add the file to a project. Share
or publish the file using the Project Manager functions.
l To capture report results in a file, add the Toad Report automation activity. This activity runs a Toad report
and saves the results in a file format you select. Share or publish the file using the Automation functions.
l To execute and save a query in a file, add the Select To File automation activity. This activity runs a query
or SQL script and exports the results to an Excel spreadsheet. Share or publish the spreadsheet using the
Automation functions.
This tutorial helps you get started with Automation by giving you an overview of the Automation module and
then guiding you through the process of creating a basic script.
In this tutorial you will learn:
l How to use the Automation window
l How to create a basic script using the Select to File activity
l How to test and run a script
l How to schedule a script
l How to create a template for reusing an Automation activity
Note: The Automation module is disabled if Toad was installed with the Prohibit saving passwords
option selected.
Introduction
Toad provides an Automation utility that allows you to easily script database activities and schedule them using
the windows scheduler. In this way, database tasks can be automated to save you time. Toad Automation can
increase your productivity by allowing you to automate tasks that you perform repeatedly.
The Benefits of Using Automation
l Automating repeatable tasks allows you to be more productive and increases your efficiency.
l Toad Automation scripts are very flexible and extensible, allowing you to customized them to
your needs.
l You can create and use variables in Automation scripts. Variables allow you to make your scripts flexible
and to customize your scripts to different audience and company needs.
l You can incorporate a variety of templates into Automation scripts. Using templates in your scripts can
help you get the most out of automating your tasks. Templates include: Microsoft Excel® files, Export
Wizard templates, or Toad Report templates. You can even create an Automation activity template
allowing you to reuse an activity.
l There is no limit to the number of tasks you can include in an automation script.
l Toad Automation scripts are conveniently scheduled and run by the Windows scheduler. You can track
and manage your scheduled scripts using Toad or the Windows Scheduler interface.
Toad sends your SQL to the Automation Tutorial (Guided Tour) which opens in a separate
window.
3. Select a task and complete the wizard.
4. After you click Finish in the wizard, an Automation window opens containing your new script.
The script incorporates your SQL statement and the settings you specified in the wizard.
Note: You must drag the activity to an Add Activity icon in the Automation workflow. When you see the
activity's icon displayed in the workflow, release the mouse button.
Details Pane—Displays an activity’s settings. Click an activity in the design pane to display its
configurable settings in the details pane. Use the details pane to specify the settings for each activity in
the script.
2. In the Toolbox, find the Database Activities group. Single-click the Select to File activity to add it to the
script design pane.
3. With the Select to File activity still selected in the script design pane, view the details pane. The details
pane allows you to configure settings for the selected activity. The input fields change depending on
which activity is currently selected in the design pane.
Note: The Activity Input tab is the tab where you will specify most of an activity's settings.
4. Click next to the Select to File activity. Toad uses this icon to indicate that more information is
required to complete the activity. Click or hover over the icon to display the missing information. Use this
icon to help you determine which input fields are required.
Note: This icon is also used to indicate a validation error, for example, when referencing a variable that
has not been created yet.
6. Click the Stop on Error button, if not already selected. This instructs the script to stop if an error is
encountered.
Note: You can also enable or disable the Stop on Error option for each individual activity. If you know
that a particular activity will have an error, you can disable the Stop on Error option for just that activity.
This option is located on the Activity Info tab for each activity.
7. In addition to selecting the Stop on Error option, enabling the Send email when error occurs and
Attach log file to email options is also preferred. This can be very useful if your script encounters an
error. Enabling your script to send an email notification on error, as well as on success, helps you to feel
confident that your processes are running as expected.
If you choose to enable these options, you must specify email settings. To specify email settings, click the
Compose Email button.
8. Keep this Automation script window open, and proceed to the next section.
Note: If you schedule a script to run against a password-protected database for which you did not save
the password in Toad, the script will error. To save the password, right-click the connection in the
Connection/Navigation Manager and select Properties. Enter the password and select the Save
Password option.
3. Now select an input. Most activities require an input, and in the Select to File activity the input is a SQL
statement. You can input a SQL statement using one of the following methods:
l Manually enter a SQL statement in the editor box (deselect the Link SQL file option).
l Select Link SQL file, then click to browse to and select a SQL file. This option retains a link to
the SQL file.
l Click to open the SQL file (you previously selected) in the Editor where you can
modify the SQL.
l Select Link SQL file, then click the drop-down list to select a file from the currently open project in
the Project Manager.
5. Click in the Name field and select a location and enter a name for your new Excel file.
6. You can also add a suffix to the file name. In the suffix field, click the drop-down to select a datetime
stamp, or click to build an expression. You can use this method to add a variable or a custom
datetime stamp. Appending a datetime stamp to the file name allows you to create a unique file with
each script execution.
7. You now have a complete activity, with input, output, and database connection specifications. You can
save and reuse this activity in other scripts by saving the activity as a template. To do this, right-click the
activity (after configuring all the settings) and select Save As Template. Enter a name for your template
and click OK to save it.
Your template now appears in the Toolbox in the Templates category.
8. Keep the Automation script window open and proceed to the next section.
3. Toad then validates your entries and compiles the script. If these processes are successful, the
script runs.
4. While the script is running, Toad displays your script’s execution progress in the Log tab. The message
“Done” indicates script execution is finished.
5. When a script produces an output file, a hyperlink to the output file is included in the Log. If your script
ran successfully, click the output file hyperlink to view the new Excel file created by your script.
6. Click the Settings icon to return to the script’s settings.
10. If you remember from the overview of the Automation window, Toad allows you to enable or disable
each activity in a script. This can be helpful when building a script, as it allows you to test one particular
activity at a time by disabling the other activities.
In the Activity Info tab, click Disabled to disable the Select to File activity. Notice that the activity now
appears shaded in the design pane. To enable the activity again, click Enabled, or right-click the activity
in the design pane and select Enabled.
3. To schedule the script, select the Triggers tab. Then select the scheduling trigger and click Edit. In the
Edit Trigger dialog, ensure that the On a schedule trigger type is selected. Then specify a frequency, start
time, interval, etc.
4. Click OK to save your schedule. Click OK to save and close the task properties dialog.
5. Your task (script) is now listed in the Task List in the Job Manager. Double-click your task in the list to
open the task properties dialog again where you can make modifications, such as re-scheduling or
changing the script location. Use the Task List to review the status of your tasks (scheduled scripts).
6. By default, the scheduled task runs under your Windows account. If you change your Windows
password, you may also need to update the password in your scheduled task (depending on your
version of Windows). Click and select the task to update. Click OK and then enter your password
when prompted.
Introduction
After creating a result set in Toad, you may need to send the results to your end users. The easiest way to
create a report containing query results is to export the data to an Excel file by right-clicking the data grid and
selecting Quick Export | File | Excel File. This action creates a basic Excel spreadsheet containing the result
set from the data grid.
If you want to create more than a basic spreadsheet and automate the process, Toad Automation helps you
build a variety of Excel reports, from simple worksheets to complex and attractive Excel reports.
In this introduction to automating Excel reports, you will learn how to automate the process of exporting data to a
variety of simple Excel reports.
Note: To learn how to get started with Automation, see Getting Started with Automation.
l Select Link SQL file, then click to browse to and select a SQL file.
l Click to open the SQL file (you previously selected) in an editor where you can
modify the SQL.
l Select Link SQL file, then click the drop-down list to select a file from the currently open project in
the Project Manager.
5. Select Excel in the Type field in the Export to File section.
6. Click in the Name field to select a location and enter a name for your new Excel file, or you can select
an existing file.
Note: To specify more-detailed options for the Excel file, click the Export options button.
7. (Optional) You can choose to create a unique file by adding a suffix. In the suffix field, click the drop-
6. In the Name field, click to select a location and enter a name for your file.
7. Leave the suffix field blank (adding a date/time suffix could create a new file with each script execution
and this is not the objective of this example).
8. Deselect Overwrite (you do not want to overwrite the file).
9. Now click Export options. The Export options dialog opens.
10. In the Worksheet name field, enter a name to be used as the base worksheet name.
11. Select Append timestamp to named worksheet. This will append the date and time (that the data was
exported) to the base worksheet name. Click OK to save your settings and close the dialog.
6. Click in the Name field to select a location and enter a name for your new Excel file.
7. Click Export options and make sure the Worksheet name field is blank.
Note: If the Worksheet name field is not blank, your script will export both result sets into the named
sheet, and the second result set will overwrite the first.
8. Selecting to overwrite the existing file or to add a date/time suffix to the file name is optional in
this example.
9. Click Run to save and run your script.
10. Open the new file by clicking the link in the Log tab. Notice that the file contains a separate worksheet for
the result set of each query.
The output of this script is one Excel file containing multiple worksheets. Each worksheet contains the result set
of a different query.
Schedule A Script
See Schedule Your Script to learn how to schedule the Automation script.
Automate Tasks
Use Automation to schedule a single script to run reports and queries, save results in Excel spreadsheets, and
distribute results to the business community via email. You can schedule scripts that perform long-running tasks
to run when database activity is light.
You can also use variables in automation scripts. With variables, you can update information that may be
different each time you run the script, such as the department name, revenue, fiscal quarter, or product name.
See "Using Variables in Automation" on page 91 for more information.
For example, assume you are an analyst at Nick's Flicks movie rentals. You need to run inventory and movie
rental reports on a daily basis and distribute them to managers of the inventory department. Using Toad, you
can create an automation script that runs the reports, exports them to Excel spreadsheets, and emails the
spreadsheets to the inventory department everyday at 2:00 AM.
Troubleshooting: You must surround a variable name with the # sign (for example, #sleep#).
Notes:
l Automation scripts are compatible with the version of Toad in which they are created.
l The Automation module is disabled if Toad was installed with the Prohibit saving passwords
option selected.
3. To build a script, single-click an activity in the Toolbox, or drag an activity from the Toolbox to the
Automation script design window. Repeat this process to add additional activities to your script.
Note: You must drag the activity to , then release the mouse button after you see the activity's
icon replace .
4. Click an activity in your script workflow in the design window and then specify the activity's properties in
the details pane (bottom pane). Repeat this process for each activity in your script. For a step by step
tutorial on building an Automation script, see Getting Started with Automation.
See the following topics for details about each activity and its properties:
Add to Project Add an automation script to the current project in the Project Manager. The
script is automatically placed in the project's Automation Scripts folder.
Save an automation script (.tas) in a folder on a local or network drive.
Save
Run Run an automation script before scheduling it. The script executes once and
the execution log is displayed in the Log window. Resolve any problems that
cause activities to fail, or disable failed activities before scheduling the script.
Tips:
l Press F5 to run the automation script.
l To view the script log, select the Log tab or select View | Output.
Publish Publish script to Toad Intelligence Central.
Schedule Schedule an automation script in the Job Manager. You can schedule a script
to execute once or to run periodically at a defined interval. See "Execute and
Schedule Automation Scripts" on page 95 for more information.
Important: To rename an Automation script file, do so through Toad (File | Save File As), not through Windows
Explorer. Renaming a script file using Toad ensures that log files are created correctly and properly synced with
their scripts.
Tips:
l Double-click an activity in the script design window to open the Activity Properties pane in a format used
in earlier versions of Toad.
l Right-click within the script design window and select Print Script to print the script's workflow diagram.
Activity Description
Select to File Execute an existing SQL script, Query Builder file, or Editor file and export the results to
an Excel, HTML, or CSV file.
l Click to open the SQL file in the Editor where you can modify the
SQL file.
l Enter a SQL statement in the editor. You must first deselect the Link SQL
file option.
3. RowCount variable—Enter a name for the row count variable or use the default.
The value assigned to this variable equals the number of rows returned from the
activity. See "Using Variables in Automation" on page 91 for more information.
4. Export File Type—Select an export file type.
5. Export File Name—Click to select a file location and enter a file name. To
use a variable as a suffix, enter the hash symbol before and after the variable
name (#VariableName#).
6. Suffix—Select a suffix to append to the file name. Select from the list of existing
l Click to open the SQL file in the Editor where you can modify the
SQL file.
l Enter a SQL statement in the editor. You must first deselect the Link SQL
file option.
3. Save result set in variable—Enter a name for the result variable, which contains
a data table with the results of the execution script.
Tip: You can use the result variable with the Loop Dataset activity. See "Use
System Automation Activities" on page 85 for more information.
4. Local Storage—To export the results to Local Storage, select a database and a
new or existing table (or snapshot).
5. Intelligence Central—To export the results to Intelligence Central as a dataset,
click Publishing Wizard and specify your publishing options.
Review the following for additional information:
l RowCount variable—Enter a name for the row count variable or use the default.
The value assigned to this variable equals the number of rows returned from the
activity. See "Using Variables in Automation" on page 91 for more information.
l Overwrite existing dataset—Select to overwrite an existing dataset with the
same name.
Select to Editor with Execute an existing SQL script or Query Builder query and save it and any results sets
Results in a Toad editor file (.tef).
This file format is useful for building scripts that have large result sets that you do not
want to continue executing or for saving results when you have not finished building a
script.
1. Select a database connection.
2. Select a SQL file or enter a SQL statement.
l Click the drop-down list to select a file from the currently open project in
the Project Manager.
l Click to open the SQL file in the Editor where you can modify the
SQL file.
l Enter a SQL statement in the editor. You must first deselect the Link SQL
file option.
3. Result saved in Editor file—You can select an Editor file from an open project or
3. Export to file—Select a file type and enter a file name and location for your
export file. You can use a variable in this field by entering the hash symbol
before and after the variable name (#VariableName#).
l To export to an Excel pivot table, select Excel Pivot.
l Click Export Options to specify Excel file options.
4. Suffix—Select a suffix to append to the file name. Select from the list of existing
l Suffix—Select a suffix to append to the file name. Select from the list of existing
l Next, add activities to the loop to execute for each connection in the connection
list.
Note: The connections you specify in the Loop Connections activity take precedence
over any connection specified in an individual activity.
Dimensional Open an existing Dimensional View file, execute the query, and export the data to
Viewer Excel, Local Storage, or Intelligence Central.
1. Select an existing Dimensional View file.
2. Export to file—To export data to Excel or .csv, select a file type, a file location,
and a file name. Click Export Options to specify export options. In the Export
dialog, each tab represents a view.
the list, select the suffix, click , delete the suffix in the Expression field, and click OK.
l Automation does not support positional parameters denoted by a question mark.
l For each applicable activity, you can specify the database connection in the activity's properties. The
default connection is the currently-active open connection.
l The connection associated with an activity takes precedence over the connection information in a
report or SQL script, unless the report or SQL script information is a cross-connection query.
Activity Description
Copy File Copy or move one or more files to another location (for example, to a shared folder
where they can be accessed by your business community).
Review the following for additional information:
l Source file—Select the file to copy.
In this field, you can also use the asterisk (*) and question mark (?) wildcard
characters, as well as variables, in the file name to help you select one or more
files (in the same directory) to copy. To use this method:
suffixes, or click to select a variable or build a new suffix using the expression
editor.
l Delete source file—Select to move the file from the source folder to the
destination folder. Deselect to copy the file to the destination folder.
l Retry—Specify the number of times to retry the copy action if an error or timeout
occurs.
l Wait—Specify the number of seconds to wait between retries.
Delete File Delete one or more files from one or more specified locations. You can also use this
activity to delete files that are created previously in the script.
Files to delete—Click Add Files to select one or more files to delete. In the File Collection
Editor, do one or both of the following:
l To delete files created previously in the script, select a file in the left pane and
click Add.
Note: When a file name is displayed for selection in the left pane, any variable
names that are used in the file name are visible (#MyVariable#), but suffixes are
not visible.
l To select other existing files, click to browse to and select the files.
In this field, you can also use the asterisk (*) and question mark (?) wildcard
characters, as well as variables, in the file name to help you select one or more
files (in the same directory) to delete. To use this method:
1. Specify the file directory by browsing to and selecting one of the files.
2. Then modify the file name in the Files to Delete pane using wildcard
characters and/or variables.
Note: As an example of using wildcards and variables, using the file name
MonthlyReport_#var#*.xls, where #var# is Feb, would delete all reports whose
file name begins with "MonthlyReport_Feb" in the same directory.
Log Comment Writes a comment to the scripts's log.
Log message—Enter the text of the comment you want to insert into the log when this
activity executes.
Zip/Unzip Files Create a zip file (compressed folder) and add files to it. You can add files created
previously in the script to the zip file. Use this activity to zip multiple files and then attach
the zip file to an email using the Email activity.
You can also use this activity to unzip a zip file.
Review the following for additional information:
Zip Tab
l Archive name—Select a location and name for the zip file. You can use a variable
in this field by entering the hash symbol before and after the variable name
suffixes, or click to select a variable or build a new suffix using the expression
editor.
l Password—Enter a password if you want to password protect the zip file.
l Hide password—Select this option to mask password during input.
l Encryption—Select whether to create a zip file without encryption (Standard) or to
encrypt the zip file.
Note: If you encrypt the zip file, you must have a zip utility that can support 128-bit
or 256-bit decryption.
l Zip all files in this directory—Select a directory. All files in the directory will be
added to the zip file. You can use both this field and the Source files field to
select files to add to the zip file.
l Source files—Click Add Files to select one or more files to add to the zip file. In
the File Collection Editor, do one or both of the following:
l To add files created previously in the script, select a file in the left pane
and click Add.
Note: When a file name is displayed for selection in the left pane, any
variable names that are used in the file name are visible (#MyVariable#),
but suffixes are not visible.
l To select other existing files, click to browse to and select the files.
In this field, you can also use the asterisk (*) and question mark (?)
wildcard characters, as well as variables, in the file name to help you
select one or more files (in the same directory) to add. To use this method:
1. Specify the file directory by browsing to and selecting one of the
files.
2. Then modify the file name in the Files to Archive pane using
wildcard characters and/or variables.
Unzip Tab
l Archive name—Select a zip file.
l Password—If password-protected, enter the password.
l Extract to folder—Select a location to extract the files to.
To learn how to use the Zip/Unzip Files activity, see the following:
l Automation and the Zip Activity (video)
Find and Replace This activity opens one or more files and performs find and replace actions inside the
files. You can write the results to a different location and file name.
Review the following for additional information:
l Find/Replace—You can have multiple Find/Replace tasks within one activity. You
can specify a different source file, save file, and action for each Find/Replace
task.
l Source file—Select the file in which to perform the find and replace action for the
selected Find/Replace task.
In this field, you can also use the asterisk (*) and question mark (?) wildcard
characters in the file name to help you select one or more files (in the same
l Suffix—Select a suffix to append to the file name. Select from the list of existing
suffixes, or click to select a variable or build a new suffix using the expression
editor.
Note: Use drag and drop or up/down arrows to change the order of multiple
Find/Replace tasks in one activity.
To learn how to use the Find and Replace activity, see the following:
l Automate Find and Replace (video)
FTP File Upload or download one or more files using an FTP or SFTP connection. Review the
following for additional information:
l Select an FTP connection—Select an FTP connection or define a new
connection.
Note: You can define a new connection prior to using the FTP activity by
selecting View | FTP Connections.
l Transfer ONLY if—Select this option to set conditions for FTP transfer, and then
select a condition from the list. If you select this option, the FTP activity only runs if
the condition you specify is met.
the list, select the suffix, click , delete the suffix in the Expression field, and click OK.
l Automation does not support positional parameters denoted by a question mark.
Tips:
l For activities in which you can add a suffix to the output file, click to build a suffix using the
expression editor.
l You can use the expression editor to select a variable created in a previous activity or select one of your
stored bind variables.
Activity Description
Set Variable Automation variables are a powerful tool that can greatly extend your scripts by adding
flexibility and customization. You can use variables to represent and store data that
may be different each time the script executes. Variables can be used with almost every
Automation activity.
l Connection—Select a connection.
l SQL script file—Select a SQL file to use as the driving query. After the script
executes, the result set of the driving query is stored in the dataset variable.
l Click the drop-down list to select a file from the currently open project in
the Project Manager.
l Click to open the SQL file (you just selected) in the Editor where you
can modify the SQL.
l Link SQL file—Select to link the SQL script file you selected in the previous step.
l SQL script—Enter a SQL statement to use as the driving query (if you did not
select a SQL file).
l RowCount variable—Enter a name for the row count variable or use the default.
The value assigned to this variable equals the number of rows returned from the
activity. See "Using Variables in Automation" on page 91 for more information.
l From—Enter your email address or click to auto-populate this field with your
email address.
Note: If you encounter a security alert message from your email application,
and you want to use this auto-populate feature, grant Toad access (at least
temporarily).
l After selecting a script, click to open the child script in a new window.
l Return code variable—Enter a variable name or use the default name. The
return code variable is a built-in variable. After the child script executes, the
return code value is stored in this variable. Return code values are:
o 0 = Successful execution
o 999 = An error occurred during execution
o 111 = An error occurred, but you selected continue on error.
You can use this variable with the If Condition activity.
Pause Stops an activity for a specified number of seconds before continuing. This is useful, for
example, if you are using parallel activities and need to pause one branch while
waiting for results or the complete execution of another branch.
For an example of how to use the Pause activity in an Automation script, see the
following:
l Using the While Loop in Automation (video)
Group Activities Use this activity to group and organize two or more activities together.
Throw Error Use this activity to generate an error and add a custom error message to the script
execution log.
Select Stop On Error to stop the script after the error is logged. This option is
independent of the global Stop/Continue on Error option specified in script Settings or
the Stop on Error option in the Activity Info tab. This activity generates a script exit code
of 555.
Parallel Run two or more activities in parallel.
After adding the activity to the design window, hover over the activity to display a drop-
down list of view options.
View Parallel—Normal view.
View Cancel Handler—Select to add cancel handler activity.
View Fault Handlers—Select to add fault handler activity.
This activity can have one or more branches. To delete a branch, select it and press
Delete. To add a branch, right-click the activity (the outside loop) and select Add
Branch.
Notes:
l To disable an activity, right-click the activity in the design window and select Disabled. This is helpful if
you want to disable an activity while testing other activities.
l The Stop on Error option for each activity allows you to select whether to stop or continue execution if
Toad encounters an error during that activity.
the list, select the suffix, click , delete the suffix in the Expression field, and click OK.
l Automation does not support positional parameters denoted by a question mark.
l Return code variable— This integer type variable is created by the Run Automation Script and the Run
Program activities. The variable value is assigned based on the execution status of the script or program.
l Built-in SQL type variables—The Loop Dataset and Execute Script activities create a SQL type variable
which is used to store the result set of a query. The Loop Connections activity creates a SQL type
variable with only one row containing connection information.
l Activity Result variable—This variable captures the result of each activity's execution. If an error occurs, it
captures the error message. The name of this variable is _ACTIVITY_RESULT.
The Automation script creates the following built-in variables.
l Root path variable—This string type variable is created by the script. The value assigned to this variable
is the path you specified in the Root path field in either the Test environment or the Production
environment area in script Settings. The path that is applied depends on which environment (Test or
Production) is selected at the time the script is executed.
l Run mode variable—This string type variable is created by the script. The value assigned to this variable
is either Test or Production, depending on the environment selected in the script Settings at the time the
script is executed.
Using a String. For a String variable type, surround the date value in single quotes. This ensures that date
delimiters, such as the dash (-) or forward slash (/), do not cause Toad to interpret the value as an expression.
‘2017-7-7’ is treated as a string
2017-7-7 is evaluated to 2003
Variable Scope
When you are building an Automation script that uses a variable, it is important to understand the variable's
scope of visibility. This section describes the concept of variable scope in Automation scripts.
5. When finished, click OK to save your changes and close the task properties dialog. For detailed
information about the task properties dialog, see "Schedule Windows Tasks" in the online Help.
Note: To run a scheduled script against a password-protected database, the password must be saved in the
Connection Properties dialog.
Quest creates software solutions that make the benefits of new technology real in an increasingly complex IT
landscape. From database and systems management, to Active Directory and Office 365 management, and
cyber security resilience, Quest helps customers solve their next IT challenge now. Around the globe, more than
130,000 companies and 95% of the Fortune 500 count on Quest to deliver proactive management and
monitoring for the next enterprise initiative, find the next solution for complex Microsoft challenges and stay
ahead of the next threat. Quest Software. Where next meets now. For more information, visit www.quest.com.
Contact Quest
For sales or other inquiries, visit www.quest.com/contact.
compare differences 45
A
export in one click 45
activities, automation 70
in result sets 43
automation 70
reports tutorial 49
database activities 74
Database Diagram
execute automation scripts 95
tutorial 26
file activities 81
Database Explorer
system activities 85
best method for locating objects 19
variables 91
filter databases and objects 20
B search for objects 25
build queries database objects 19
create cross-connection queries 32 filter schemas 20
reverse engineer queries 34 object explorer 19
C search for 25
databases
code
automation activities 74
automating 70
Diff Viewer, data 45
shortcut keys 41
L search 25
database objects 25
linked queries 47
shortcut keys 41
M
SQL
Master Detail Browser 28 automating scripts 70
O shortcut keys 41
SQL Azure
Object Explorer 19
create connections 13
filter databases and objects 20
SQL Editor 39
search for objects 25
SQL Server
object search 25
create connections 13
ODBC
troubleshoot 16
create connections 9
subqueries
One Click Export 45
tutorial 36
Oracle
system automation activities 85
Oracle, create connections 11
Q T
tables
Query Builder
browse data in related 28
create cross-connection queries 32
troubleshoot
reverse engineer queries 34
SQL Server connections 16
tutorial 30
tutorials 49
R
create database diagrams 26
reports 53 create ODBC connections 9
data tutorial 49 create Toad data reports 49
DB2 54 subquery 36
manage reports 53 visually build queries 30
MySQL 56
ODBC 56