empty SELECT SUM outputs....

Results 1 to 3 of 3

Thread: empty SELECT SUM outputs....

  1. #1
    Andreas Theodopolopolis Guest

    Default empty SELECT SUM outputs....

    I&#039;m sure this is a common question...<BR>I have a SELECT SUM running on my DB using ASP (DSNLess)<BR><BR>Sometimes this returns empty. i.e. there are no records to count.<BR><BR>Now when it is empty, the query seems to return some kind of odd datatype. I want it to be changed to "0".<BR><BR>So using ASP I tried:<BR>if rs.EOF then<BR> output = "0"<BR>else<BR> output = rs("myCount")<BR>end if<BR><BR>I tried:<BR><BR>if rs("myCount") = null .....<BR><BR>I tried: <BR><BR>if rs("myCount") = 0<BR><BR>I tried:<BR><BR>if rs("myCount") = ""<BR><BR><BR><BR>All tries output a blank. ASP just can&#039;t detect that blank, its not null, its not empty, so WHAT is it?<BR><BR>Cheers in Advance<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: empty SELECT SUM outputs....

    Try:<BR>select SUM(Whatever) as "Total" from...<BR><BR>if isNumeric(rs("Total")) then<BR> output = rs("myCount")<BR>else<BR> output = "0"<BR>end if<BR><BR>that should work providing your db field is "SUM-able"<BR>

  3. #3
    Andreas Theodopolopolis Guest

    Default RE: empty SELECT SUM outputs....

    I just wanted to say thanks, even if you don&#039;t read this. It worked great.

Posting Permissions

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