Monday, February 15, 2010

Division by zero?

What will be the value of @A in the following statement?

SET ARITHABORT OFF
SET ANSI_WARNINGS OFF
DECLARE @A INT
SET @A = 2010/0

A. 0
B. NULL
C. Infinity
D. An error is generated.

Answer:[B]
Explanation: When both ARITHABORT and ANSI_WARNINGS set to OFF, SQL Server will return a NULL value in a calculation involving a divide-by-zero error.
Highlight to find out the answer.

No comments:

Post a Comment