data type of returned select sum if result is noth

Results 1 to 4 of 4

Thread: data type of returned select sum if result is noth

  1. #1
    Join Date
    Dec 1969
    Posts
    106

    Default data type of returned select sum if result is noth

    Hi All<BR><BR>I have the following problem.<BR><BR>I&#039;m using a SELECT SUM(columnName) statement in a SQL7 stored procedure. I call this procedure via a function and assign the returned value to the integer "varUserScore".<BR><BR>I&#039;m using an if else statement to find out whether there is a score. If not then then response.write "0" otherwise return the score.<BR><BR>Now the problem arises when there is no value. How do I actually determine if there is no value. I&#039;ve tried "null", "" and 0 but these dont work. <BR>Any suggestions or help would be greatly appreciated?<BR><BR><BR><BR>

  2. #2
    Prashanth Guest

    Default RE: data type of returned select sum if result is

    Did u try &#062;0 and the else statement?

  3. #3
    Join Date
    Dec 1969
    Posts
    106

    Default RE: data type of returned select sum if result is

    I&#039;ve tried that too, but still doesn&#039;t work :(<BR><BR>I have however, just come up with a cheap way of fixing it.<BR>I&#039;ve made the interger a string and added "" in front of it.<BR>It works, but I would love to know how to do it properly

  4. #4
    Join Date
    Dec 1969
    Posts
    2,437

    Default RE: data type of returned select sum if result is

    To test for null in SQL server stored procedure use the IS predicate e.g<BR> <BR> if @score is null


Posting Permissions

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