How to suppress this "warning" message?

  • "Warning: Null value is eliminated by an aggregate or other SET operation."

    Is there a way of suppressing this warning message?

    Thanks in advance,

    Billy

  • 1. instead of "SUM(Fieldname)" try "SUM(ISNULL(FieldName, 0))"

    Caution:

    IF you are using avg function your result will be different. Without ISNULL system considers only the NOT NULL entries.

    2. If you want the same results but want to remove the warning only add

    SET ANSI_WARNINGS OFF

    G.R. Preethiviraj Kulasingham

    Chief Technology Officer.

    Softlogic Information Systems Limited,

    14 De Fonseka Place,

    Colombo 05.

    Sri Lanka.

    Cheers,
    Prithiviraj Kulasingham

    http://preethiviraj.blogspot.com/

  • Thanks!

    However, I decide that it is better to put the ISNULL in the code rather than suppress the message. Is it possible to monitor this warning message from SQL Profiler?

    Thanks in advance,

    Billy

  • Should'nt nulls be excluded entirely from the set being averaged On smaller sets it may have significant effect.

  • Hi,

    I have seen this before and the following statement suppresses this message:

    SET ANSI_WARNINGS OFF

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

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