This control enables users to specify that database warnings are to be treated as though they are errors. This allows the ERRORLEVEL status value to also be assigned to the severity level associated with each encountered warning.
When neither ON or OFF is supplied, BTEQ sets ERRORONDBSWARNINGS to ON.
The command takes values ON or OFF and is OFF by default. When neither ON or OFF is supplied, ON is assumed.
The set of unique database warning codes does not overlap with the set of unique error codes. So when ERRORONDBSWARNING is set to ON, the ERRORCODE and ERRORLEVEL status value keywords can actually be used to refer to the superset of all database error and warning codes. This is the only way to cause ERRORLEVEL to be set to capture the severity level associated with a warning.
As long is the setting is ON, the ERRORCODE status value will get set to the same value as the WARNINGCODE status value for each successful request. So once this action is no longer needed, the control should be turned OFF.
Example 1 – ERRORONDBSWARNING ON for Testing Compiles
Assume a user need to detect that the REPLACE of a Stored Procedure has been completely successfully accomplished without errors and that they do not want to code for specific warning or error code values but rather just check to see if the ERRORLEVEL status value is still zero. Setting ERRORONDBSWARNING to ON prior to issuing the COMPILE command will enable the following concise IF...THEN... command to be subsequently used:
.IF ERRORCODE!=0 THEN .GOTO errorfound