divide by zero error

  • Hi there i am working on Autometed Testing database for the web application. I am compaire the test results within the table. there is one set of test results with flag 'M' and new test results flag set to NULL.

    In test results i am having the response size for each page saved in database, sometime theh response size value i am getting is zero, here is the small code i am using.

    Select  a.plan_name,

     a.application_name,

     a.ver_no,

     a.response_code,

     a.response_time,

     a.response_size,

     b.response_code,

     b.response_time,

     b.response_size,

     a.url

    from bsingh.vwtest_result_Null a

    inner join bsingh.vwtest_result_M b

    on a.plan_name = b.plan_name

    and a.url = b.url

    and a.application_name = b.application_name

    where (a.response_code <> b.response_code

    or a.response_size / b.response_size  not between 0.99 and 1.01 ) 

    and the error i am geeting is

    Divide by zero error encountered.

    if anybody can suggest the solution will be

  • Your problem is obviously as a result of b.response_size sometimes being zero.

    Not sure what you want to do about this, but if you wanted to replace it with a '1' in cases where it is zero, you can use something like this, in place of 'b.response_size':

    IsNull(NullIf(b.response_size,0),1)

    Regards

    Phil


  • Thanks Phil for the Solution, I am using this and its working with my Query

  • Thanks Phil for the Solution, I am using this and its working in my Query

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply