Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. null to 0

null to 0

Scheduled Pinned Locked Moved Database
database
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vipin d
    wrote on last edited by
    #1

    hi, i am using MSSQL2000. i wrote a query with sum() of aggregate function. like Select sum(sal)from table1 where empid=1 and date>'1/23/2006' in this if thers is no record it rteurn 'NULL' is it possible to return it as 0

    All I ever wanted is what others have....
    CrazySanker

    V Z 2 Replies Last reply
    0
    • V Vipin d

      hi, i am using MSSQL2000. i wrote a query with sum() of aggregate function. like Select sum(sal)from table1 where empid=1 and date>'1/23/2006' in this if thers is no record it rteurn 'NULL' is it possible to return it as 0

      All I ever wanted is what others have....
      CrazySanker

      V Offline
      V Offline
      Vipin d
      wrote on last edited by
      #2

      i got its answer SELECT isnull(sum(Sal),0) FROM table1 WHERE...

      All I ever wanted is what others have....
      CrazySanker

      1 Reply Last reply
      0
      • V Vipin d

        hi, i am using MSSQL2000. i wrote a query with sum() of aggregate function. like Select sum(sal)from table1 where empid=1 and date>'1/23/2006' in this if thers is no record it rteurn 'NULL' is it possible to return it as 0

        All I ever wanted is what others have....
        CrazySanker

        Z Offline
        Z Offline
        zhousz
        wrote on last edited by
        #3

        of cause, the code like this: Select case when sum(sal) is null then 0 esle sum(sal) end from table1 where empid=1 and date>'1/23/2006' :laugh:

        V 1 Reply Last reply
        0
        • Z zhousz

          of cause, the code like this: Select case when sum(sal) is null then 0 esle sum(sal) end from table1 where empid=1 and date>'1/23/2006' :laugh:

          V Offline
          V Offline
          Vipin d
          wrote on last edited by
          #4

          thank u

          All I ever wanted is what others have....
          CrazySanker

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups