By default, the AutomateStats external stored procedure operates on statistics defined within all user databases defined in the system.
To automate never before collected statistics as defined by a list of SQL COLLECT STATISTICS statements residing in a text file, do the following:
- Submit the statistics to the database using BTEQ or another similar client tool.
- Call AutomateStats.
AutomateStats results are written to the TDSTATS.AutomateHistoryTbl table. To display the AutomateStats results, you can call AutomateReport.
Wildcard Characters
The following table describes the wildcard characters that the names of some databases, tables, and objects contain.
Character | Description |
---|---|
% (PERCENT SIGN) | Represents any string of zero or more arbitrary characters. Any string of characters is acceptable as a replacement for the percent. |
_ (LOW LINE) | Represents exactly one arbitrary character. Any single character is acceptable in the position in which the underscore character appears. |
For more information on how to use these wildcard characters, see the SQL LIKE clause.
Automating Statistics
If you do not specify a value for the following input parameters, the operation is performed on all user created databases in the system.
What You Want to Automate | What You Must Specify |
---|---|
All statistics for a database | DatabaseName value. |
All statistics for a table | DatabaseName value and TableName value. |
A list of objects that cannot be specified by DatabaseName or TableName | ObjectListName that was previously created by the CreateObjectList and AddObjectListEntry external stored procedures. ObjectListName usage is mutually exclusive with DatabaseName and TableName . When you specify a value other than NULL for ObjectListName , DatabaseName and TableName must be NULL. |