Global Switches

Log Parser

Global Switches

Global switches control overall behaviors of a command, and they are used with most of the Log Parser command-line executable operational modes.

The global switches are:

-e:<max_errors>
-iw[:ON|OFF]
-stats[:ON|OFF]
-q[:ON|OFF]

-e:<max_errors>
Specifies a maximum number of parse errors to collect internally before aborting the execution of the command.
The default value for this global switch is -1, which is a special value causing the SQL engine to ignore all parse errors and report only the total number of parse errors encountered during the execution of the command.
The following example command sets the maximum number of parse errors to 100:
C:\>LogParser "SELECT Message FROM System" -e:100
For more information on parse errors and the "-e" switch, see Errors, Parse Errors, and Warnings.
-iw[:ON|OFF]
Specifies whether or not warnings should be ignored.
The default value is "OFF", meaning that run time warnings will not be ignored and will trigger an interactive prompt to the user. Specifying "ON", on the other hand, disables the interactive prompt, and run time warnings will be ignored and their total count will be reported when the command execution has completed.
The following example command executes a query ignoring run time warnings:
C:\>LogParser "SELECT Message FROM System" -iw:ON
For more information on warnings and the "-iw" switch, see Errors, Parse Errors, and Warnings.
-stats[:ON|OFF]
Specifies whether or not command execution statistics should be displayed when the command execution has completed.
The default value is "ON", causing command execution statistics to be always displayed. Specifying "OFF" prevents the statistics from being displayed.
The following example command executes a query preventing the statistics from being displayed:
C:\>LogParser "SELECT COUNT(*) FROM System" -stats:OFF
-q[:ON|OFF]
Enables or disables "quiet mode".
When "quiet mode" is enabled, the console output of a command contains only the output records, suppressing any additional information. For this reason, the console output of a command executed in "quiet mode" is suitable to be redirected to a text file.
Enabling "quiet mode" disables the display of parse errors, warnings, and statistics. In addition, if the selected output format is the NAT output format, its "rtp" and "headers" parameters are automatically set as follows:
  • -rtp:-1
  • -headers:OFF
As an example, the output of following command shows the extra information and the NAT output format headers that are normally displayed to the console:
C:\>LogParser "SELECT COUNT(*) FROM System"
COUNT(ALL *)
------------
6913

Statistics:
-----------
Elements processed: 6913
Elements output:    1
Execution time:     0.13 seconds
In this example, enabling "quiet mode" suppresses the headers displayed by the NAT output format and the query execution statistics, and the output would look like the following:
C:\>LogParser "SELECT COUNT(*) FROM System" -q:ON
6913


See also:

Command-Line Operation Reference
Errors, Parse Errors, and Warnings


© 2004 Microsoft Corporation. All rights reserved.