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. Other Discussions
  3. The Weird and The Wonderful
  4. Are you sure that it's not null?

Are you sure that it's not null?

Scheduled Pinned Locked Moved The Weird and The Wonderful
question
7 Posts 6 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.
  • J Offline
    J Offline
    JeremyBob
    wrote on last edited by
    #1

    Recently found this in one of our stored procs. I think they really wanted to make sure the values are not null.

    SELECT
    IsNull(CASE WHEN Sum(IsNull(I.Value1,0)) IS NULL THEN 0 ELSE Sum(IsNull(I.Value1,0)) END, 0) - (Sum(IsNull(I.Value1,0)) + Sum(IsNull(I.Value2, 0)) - Sum(IsNull(I.Value3, 0))))) * 100 / ((100 * @Vatrate) + 100) AS Net
    FROM I

    I have renamed the table and field names. And don't even get me started on the problems with the vatrate.

    Y J 2 Replies Last reply
    0
    • J JeremyBob

      Recently found this in one of our stored procs. I think they really wanted to make sure the values are not null.

      SELECT
      IsNull(CASE WHEN Sum(IsNull(I.Value1,0)) IS NULL THEN 0 ELSE Sum(IsNull(I.Value1,0)) END, 0) - (Sum(IsNull(I.Value1,0)) + Sum(IsNull(I.Value2, 0)) - Sum(IsNull(I.Value3, 0))))) * 100 / ((100 * @Vatrate) + 100) AS Net
      FROM I

      I have renamed the table and field names. And don't even get me started on the problems with the vatrate.

      Y Offline
      Y Offline
      Yusuf
      wrote on last edited by
      #2

      are you sure? are you really sure? are you really really sure? are you really really really sure? are you really really really really sure? are you really really really really really sure?

      Yusuf May I help you?

      T J 2 Replies Last reply
      0
      • Y Yusuf

        are you sure? are you really sure? are you really really sure? are you really really really sure? are you really really really really sure? are you really really really really really sure?

        Yusuf May I help you?

        T Offline
        T Offline
        ThatsAlok
        wrote on last edited by
        #3

        Yusuf wrote:

        are you sure? are you really sure? are you really really sure? are you really really really sure? are you really really really really sure? are you really really really really really sure?

        Cool! Cool Cool! Cool till infinity :-)

        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
        Never mind - my own stupidity is the source of every "problem" - Mixture

        cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

        1 Reply Last reply
        0
        • J JeremyBob

          Recently found this in one of our stored procs. I think they really wanted to make sure the values are not null.

          SELECT
          IsNull(CASE WHEN Sum(IsNull(I.Value1,0)) IS NULL THEN 0 ELSE Sum(IsNull(I.Value1,0)) END, 0) - (Sum(IsNull(I.Value1,0)) + Sum(IsNull(I.Value2, 0)) - Sum(IsNull(I.Value3, 0))))) * 100 / ((100 * @Vatrate) + 100) AS Net
          FROM I

          I have renamed the table and field names. And don't even get me started on the problems with the vatrate.

          J Offline
          J Offline
          JeremyBob
          wrote on last edited by
          #4

          My favorite part here is the CASE statement.

          S 1 Reply Last reply
          0
          • Y Yusuf

            are you sure? are you really sure? are you really really sure? are you really really really sure? are you really really really really sure? are you really really really really really sure?

            Yusuf May I help you?

            J Offline
            J Offline
            J4amieC
            wrote on last edited by
            #5

            Thats sounds like the coding equivalent of a spice girls song. I'll tell you when im sure, when im really really sure So tell me that you're sure, that you're really really sure.

            1 Reply Last reply
            0
            • J JeremyBob

              My favorite part here is the CASE statement.

              S Offline
              S Offline
              Single Step Debugger
              wrote on last edited by
              #6

              It’s absolutely redundant as is the programmer or the DBA who has created this gem.

              The narrow specialist in the broad sense of the word is a complete idiot in the narrow sense of the word. Advertise here – minimum three posts per day are guaranteed.

              L 1 Reply Last reply
              0
              • S Single Step Debugger

                It’s absolutely redundant as is the programmer or the DBA who has created this gem.

                The narrow specialist in the broad sense of the word is a complete idiot in the narrow sense of the word. Advertise here – minimum three posts per day are guaranteed.

                L Offline
                L Offline
                Lutoslaw
                wrote on last edited by
                #7

                "developer redundancy" :thumbsup:

                Greetings - Jacek

                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