Results 1 to 2 of 2
  1. #1
    Join Date
    May 2004
    Posts
    144

    Unanswered: division by zero in views

    hi
    in a view, i create a field like field1/field2.
    in case that field2 is zero, i've got division by zero error.
    how can i change the value to 0 when field2 is 0 for avoiding get error.

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Code:
    SELECT CASE WHEN 0 = field2 THEN 0 ELSE field1 / field2 END
       FROM myTable
    -PatP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •