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. The Lounge
  3. Bug of the day

Bug of the day

Scheduled Pinned Locked Moved The Lounge
c++databasearchitecturehelpquestion
42 Posts 32 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.
  • P Pete OHanlon

    Do you see how smug everyone else is that they can count and you can't? I won't belittle you the way the others have.

    Forgive your enemies - it messes with their heads

    "Mind bleach! Send me mind bleach!" - Nagy Vilmos

    My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

    F Offline
    F Offline
    Fabio Franco
    wrote on last edited by
    #30

    It's to mask the fact they are worse on everything else.

    "To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson

    1 Reply Last reply
    0
    • C Chris Maunder

      I've been banging my head against a wall trying to work out why a class in a stored procedure was being skipped.

      DECLARE @SuppressionMethod varchar(20)

      -- ... lots of code...

      SET @SuppressionMethod = 'SkipSuppressedMembers'
      If lower(@SuppressionMethod) = 'skipsuppressedmembers'
      Begin
      ...

      No matter what, the if clause was never entered. Can anyone see the head slapper? It's a groaner.

      cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

      V Offline
      V Offline
      Victor Ulloa
      wrote on last edited by
      #31

      SkipSuppressedMembers has 21 chars, not 20. You're comparing lower('SkipSuppressedMember') against skipsuppressedmembers

      1 Reply Last reply
      0
      • C Chris Maunder

        I've been banging my head against a wall trying to work out why a class in a stored procedure was being skipped.

        DECLARE @SuppressionMethod varchar(20)

        -- ... lots of code...

        SET @SuppressionMethod = 'SkipSuppressedMembers'
        If lower(@SuppressionMethod) = 'skipsuppressedmembers'
        Begin
        ...

        No matter what, the if clause was never entered. Can anyone see the head slapper? It's a groaner.

        cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

        K Offline
        K Offline
        Kabwla Phone
        wrote on last edited by
        #32

        To feed the trolls and have the string fit in the variable, you might consider increasing the length of said troll variable. Other problems in the code, using 'lower' to do a string comparission in SQL, which is case insensitive (unless you start toying with the collation).

        1 Reply Last reply
        0
        • C Chris Maunder

          I've been banging my head against a wall trying to work out why a class in a stored procedure was being skipped.

          DECLARE @SuppressionMethod varchar(20)

          -- ... lots of code...

          SET @SuppressionMethod = 'SkipSuppressedMembers'
          If lower(@SuppressionMethod) = 'skipsuppressedmembers'
          Begin
          ...

          No matter what, the if clause was never entered. Can anyone see the head slapper? It's a groaner.

          cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

          A Offline
          A Offline
          agolddog
          wrote on last edited by
          #33

          How about varchar(more)?

          1 Reply Last reply
          0
          • C Chris Maunder

            I've been banging my head against a wall trying to work out why a class in a stored procedure was being skipped.

            DECLARE @SuppressionMethod varchar(20)

            -- ... lots of code...

            SET @SuppressionMethod = 'SkipSuppressedMembers'
            If lower(@SuppressionMethod) = 'skipsuppressedmembers'
            Begin
            ...

            No matter what, the if clause was never entered. Can anyone see the head slapper? It's a groaner.

            cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

            B Offline
            B Offline
            BrainiacV
            wrote on last edited by
            #34

            It should be a SELECT, not a SET?.

            Psychosis at 10 Film at 11 Those who do not remember the past, are doomed to repeat it. Those who do not remember the past, cannot build upon it.

            C 1 Reply Last reply
            0
            • B BrainiacV

              It should be a SELECT, not a SET?.

              Psychosis at 10 Film at 11 Those who do not remember the past, are doomed to repeat it. Those who do not remember the past, cannot build upon it.

              C Offline
              C Offline
              Chris Maunder
              wrote on last edited by
              #35

              No. Take a look at the other zillion responses :)

              cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

              1 Reply Last reply
              0
              • C Chris Maunder

                I've been banging my head against a wall trying to work out why a class in a stored procedure was being skipped.

                DECLARE @SuppressionMethod varchar(20)

                -- ... lots of code...

                SET @SuppressionMethod = 'SkipSuppressedMembers'
                If lower(@SuppressionMethod) = 'skipsuppressedmembers'
                Begin
                ...

                No matter what, the if clause was never entered. Can anyone see the head slapper? It's a groaner.

                cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

                U Offline
                U Offline
                User 8347395
                wrote on last edited by
                #36

                After fixing the size of the SuppressionMethod, it seems like you will also have a problem with the "if" in that, you are assigning the values, not really checking to see if it is... If lower(@SuppressionMethod) = 'skipsuppressedmembers' Begin Should be... [IMHO] if lower(@SuppressionMethod) == 'skipsuppressedmembers' Begin Just a thought.

                M 1 Reply Last reply
                0
                • C Chris Maunder

                  Very good :thumbsup:

                  cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

                  B Offline
                  B Offline
                  BarrRobot
                  wrote on last edited by
                  #37

                  I first saw a bug like that in the 1980s, in Fortran. The system fell over on startup on Monday, 2nd September. Hint 1: The office was closed and the system shut down over the weekend. Hint 2: Which month has the longest name (it was English)? (And it wasn't me who did it!)

                  1 Reply Last reply
                  0
                  • U User 8347395

                    After fixing the size of the SuppressionMethod, it seems like you will also have a problem with the "if" in that, you are assigning the values, not really checking to see if it is... If lower(@SuppressionMethod) = 'skipsuppressedmembers' Begin Should be... [IMHO] if lower(@SuppressionMethod) == 'skipsuppressedmembers' Begin Just a thought.

                    M Offline
                    M Offline
                    Mel Padden
                    wrote on last edited by
                    #38

                    Member 8382884 wrote:

                    if lower(@SuppressionMethod) == 'skipsuppressedmembers'
                    Begin

                    Have you tried entering that in an SQL editor and running it? Just a thought.

                    Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. In the face of ambiguity, refuse the temptation to guess.

                    1 Reply Last reply
                    0
                    • C Chris Maunder

                      I've been banging my head against a wall trying to work out why a class in a stored procedure was being skipped.

                      DECLARE @SuppressionMethod varchar(20)

                      -- ... lots of code...

                      SET @SuppressionMethod = 'SkipSuppressedMembers'
                      If lower(@SuppressionMethod) = 'skipsuppressedmembers'
                      Begin
                      ...

                      No matter what, the if clause was never entered. Can anyone see the head slapper? It's a groaner.

                      cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

                      R Offline
                      R Offline
                      RDSchaefer
                      wrote on last edited by
                      #39

                      Well, aside from the obvious which everyone else has commented on, my first question would be "Why is he checking a value that he just set in the previous statement?" Was there some other code that you omitted?

                      C 1 Reply Last reply
                      0
                      • R RDSchaefer

                        Well, aside from the obvious which everyone else has commented on, my first question would be "Why is he checking a value that he just set in the previous statement?" Was there some other code that you omitted?

                        C Offline
                        C Offline
                        Chris Maunder
                        wrote on last edited by
                        #40

                        RDSchaefer wrote:

                        Was there some other code that you omitted?

                        I want to say "yes, obviously" but maybe it wasn't obvious. I didn't see the need to include all my code when showing an example.

                        cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

                        1 Reply Last reply
                        0
                        • C Chris Maunder

                          I've been banging my head against a wall trying to work out why a class in a stored procedure was being skipped.

                          DECLARE @SuppressionMethod varchar(20)

                          -- ... lots of code...

                          SET @SuppressionMethod = 'SkipSuppressedMembers'
                          If lower(@SuppressionMethod) = 'skipsuppressedmembers'
                          Begin
                          ...

                          No matter what, the if clause was never entered. Can anyone see the head slapper? It's a groaner.

                          cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

                          E Offline
                          E Offline
                          Earl Truss
                          wrote on last edited by
                          #41

                          Yes, I can. It took about thirty seconds.

                          1 Reply Last reply
                          0
                          • C Chris Maunder

                            I've been banging my head against a wall trying to work out why a class in a stored procedure was being skipped.

                            DECLARE @SuppressionMethod varchar(20)

                            -- ... lots of code...

                            SET @SuppressionMethod = 'SkipSuppressedMembers'
                            If lower(@SuppressionMethod) = 'skipsuppressedmembers'
                            Begin
                            ...

                            No matter what, the if clause was never entered. Can anyone see the head slapper? It's a groaner.

                            cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

                            V Offline
                            V Offline
                            Virendra Deshmukh
                            wrote on last edited by
                            #42

                            first line varchar(21) becoz string contains 21 chars

                            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