Question and Answer Database FAQ: FAQ4505B — Sybase / MSSQL ARITHABORT ON and "Divide by zero occurred." error. Category: Database (Sybase) Platform: All-32Bit Product: All-CBuilder, BC++5.x, C++Builder1.0, C++Builder3.x, C++Builder4.x, Delphi2.x, Delphi3.x, Delphi4.x, VdBase7.x, Question: Why doesn't the Sybase SQL Link driver raise an error when a "Divide by zero" error occurs on the server? Answer: The MSSQL and Sybase SQL Links drivers do not raise server errors with severity levels 10 and below for the reasons explained below. Setting ARITHABORT ON should change the severity level of arithmetic errors (see below). With MSSQL Server "ARITHABORT ON" appears to change the severity level of the "Divide by zero" error from 10 to 16 whereas Sybase does not change its level from 10 (as expected the underlying Sybase server behavior does change though). Both the MSSQL and Sybase documentation describe severity levels the same way (see below). MSSQL descriptions for levels 0 through 16: Severity Level 0 and 10: Status Information (Reported as Level 0) These messages are not errors; they provide additional information after certain statements have executed. [errors with levels 0 or 10 are not raised by the BDE] Severity Levels 11 through 16 These messages indicate errors that can be corrected by the user. Sybase: ------------------------------------------- set arithabort on select 1/0 Server Message: Number 3607, Severity 10 Divide by zero occurred. (0 rows affected) ------------------------------------------- set arithabort off select 1/0 Server Message: Number 3621, Severity 10 Command has been aborted. (0 rows affected) MSSQL: ------------------------------------------- set arithabort off select 1/0 (null) (1 row(s) affected) Divide by zero occurred. This error is documented as being Error: 3607 Severity Level: 10 Description: Divide by zero occurred. ------------------------------------------- set arithabort on select 1/0 Msg 8134, Level 16, State 1 Divide by zero error encountered 7/13/99 10:54:39 AM
Last Modified: 01-SEP-99