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.
  • 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

    J Offline
    J Offline
    JHizzle
    wrote on last edited by
    #3

    Ah, you just need a 6 fingered foot then you wouldn't have missed that. Fingers and toes - helping people count since year dot.

    C S 2 Replies 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

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #4

      How about varchar(42), just to be safe?

      And from the clouds a mighty voice spoke:
      "Smile and be happy, for it could come worse!"

      And I smiled and was happy
      And it came worse.

      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

        S Offline
        S Offline
        Soulus83
        wrote on last edited by
        #5

        Funny, skipsuppressedmembers == 22 chars length @SuppresionMethod is declared as varchar(20) so when you assign 'SkipSuppressedMembers' it gets truncated, Did I make myself clear?

        "Whether you think you can, or you think you can't--either way, you are right." — Henry Ford "When I waste my time, I only use the best, Code Project...don't leave home without it." — Slacker007

        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

          T Offline
          T Offline
          TheGreatAndPowerfulOz
          wrote on last edited by
          #6

          You're truncating the string. Make @SuppressionMethod a varchar(22)

          If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
          You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun

          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
            realJSOP
            wrote on last edited by
            #7

            The string you set is too long by 1 character.

            ".45 ACP - because shooting twice is just silly" - JSOP, 2010
            -----
            You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
            -----
            "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997

            1 Reply Last reply
            0
            • J JHizzle

              Ah, you just need a 6 fingered foot then you wouldn't have missed that. Fingers and toes - helping people count since year dot.

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

              Very good :thumbsup:

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

              B 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

                C Offline
                C Offline
                Chris Meech
                wrote on last edited by
                #9

                The 21 characters into a 20 character field will definitely cause headaches. How about the missing semi-colon? :)

                Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

                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

                  M Offline
                  M Offline
                  Marc Clifton
                  wrote on last edited by
                  #10

                  Without reading anyone's responses, 21 chars doesn't fit into a 20 char varchar. Marc

                  My Blog

                  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

                    P Offline
                    P Offline
                    Pete OHanlon
                    wrote on last edited by
                    #11

                    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

                    S C F 3 Replies 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
                      Ennis Ray Lynch Jr
                      wrote on last edited by
                      #12

                      But, SQL server does have a bit data-type so maybe there is a larger bug somewhere : )

                      Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

                      1 Reply Last reply
                      0
                      • 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

                        S Offline
                        S Offline
                        Slacker007
                        wrote on last edited by
                        #13

                        Pete O'Hanlon wrote:

                        I won't belittle you the way the others have.

                        belittle Chris about what exactly? :)

                        Just along for the ride. "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
                        "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011)

                        1 Reply Last reply
                        0
                        • 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

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

                          That's fine. I'm off to play with the reputation table. <Later on...> Oopsie! Looks like my counting skills still aren't up to scratch.

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

                          P 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

                            L Offline
                            L Offline
                            Lost User
                            wrote on last edited by
                            #15

                            Wrong forum, take it to DB. ;P

                            ============================== Nothing to say.

                            1 Reply Last reply
                            0
                            • C Chris Maunder

                              That's fine. I'm off to play with the reputation table. <Later on...> Oopsie! Looks like my counting skills still aren't up to scratch.

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

                              P Offline
                              P Offline
                              Pete OHanlon
                              wrote on last edited by
                              #16

                              Just remember who sucked updefended to you ;)

                              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

                              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
                                bVagadishnu
                                wrote on last edited by
                                #17

                                You forgot to drop trou while counting? :confused:

                                Schenectady? What am I doing in Schenectady?

                                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

                                  L Offline
                                  L Offline
                                  Lost User
                                  wrote on last edited by
                                  #18

                                  You're not married and therefore your member is not suppressed.

                                  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

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

                                    Using all caps for the Transact SQL operators is SO last century. :)

                                    There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

                                    C 1 Reply Last reply
                                    0
                                    • S Single Step Debugger

                                      Using all caps for the Transact SQL operators is SO last century. :)

                                      There is only one Vera Farmiga and Salma Hayek is her prophet! Advertise here – minimum three posts per day are guaranteed.

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

                                      I'm old school

                                      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

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

                                        Is there a good reason why you declared it only 20 chars long? Just checking... My auto-default for in-proc literals is nvarchar(255), just cos I have to deal with localised strings and 255 is generally long enough that I don't have to worry about catching these kinds of bugs.

                                        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.

                                        C 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

                                          P Offline
                                          P Offline
                                          Peter Mulholland
                                          wrote on last edited by
                                          #22

                                          assignment instead of equality check? Shoulda used yoda code. [edit] Ok, so after looking at the other responses i was way off, I guess. Still, is that not stringly typed code? [/edit]

                                          Pete

                                          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