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. Why would you do this to a stored procedure? It never did anything to you.

Why would you do this to a stored procedure? It never did anything to you.

Scheduled Pinned Locked Moved The Weird and The Wonderful
androidiosdatabasegame-devquestion
18 Posts 15 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.
  • T thrakazog

    ALTER PROCEDURE [dbo].[arUpdate]
    @intForecastID int,
    @strForecastName varchar(18),
    @strBillTo varchar(12),
    @strPOCName varchar(50),
    @strPOCEmail varchar(100),
    @strModifiedBy varchar(20),
    @strComment varchar(3000),
    @strDelMaterials varchar(8000),
    @strData1 varchar(8000),
    @strData2 varchar(8000),
    @strData3 varchar(8000),
    @strData4 varchar(8000),
    @strData5 varchar(8000),
    @strData6 varchar(8000),
    @strData7 varchar(8000),
    @strData8 varchar(8000),
    @strData9 varchar(8000),
    @strData10 varchar(8000),
    @strData11 varchar(8000),
    @strData12 varchar(8000),
    @strData13 varchar(8000),
    @strData14 varchar(8000),
    @strData15 varchar(8000),
    @strData16 varchar(8000),
    @strData17 varchar(8000),
    @strData18 varchar(8000),
    @strData19 varchar(8000),
    @strData20 varchar(8000)

    :wtf: None of the code in this procedure or from the calling methods looked any better. The data going into the varchar(8000) fields was delimited with a grab bag combination of special characters. Which was then pealed apart using cursors. :wtf:

    Play my game Gravity: IOS[^], Android[^], Windows Phone 7[^]

    D Offline
    D Offline
    dazfuller
    wrote on last edited by
    #8

    Because the person who wrote it likes to curl up in a small ball with a nervous twitch in their eye whilst they inappropriately touch a small fury animal. Honestly, you're better not asking, pretend you never saw it and maybe, just maybe, you'll make it through to tomorrow with a shred of sanity left in you.

    Eagles may soar, but weasels don't get sucked into jet engines

    H 1 Reply Last reply
    0
    • D dazfuller

      Because the person who wrote it likes to curl up in a small ball with a nervous twitch in their eye whilst they inappropriately touch a small fury animal. Honestly, you're better not asking, pretend you never saw it and maybe, just maybe, you'll make it through to tomorrow with a shred of sanity left in you.

      Eagles may soar, but weasels don't get sucked into jet engines

      H Offline
      H Offline
      Harry Neethling
      wrote on last edited by
      #9

      Gave me a good laugh right now :D

      1 Reply Last reply
      0
      • P Pete OHanlon

        Back slowly away. This was obviously the work of a Sociopath.

        *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

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

        CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

        F Offline
        F Offline
        Florin Jurcovici 0
        wrote on last edited by
        #10

        Unfortunately, such people insist on calling them programmers. Gives our profession a bad name ...

        1 Reply Last reply
        0
        • A Adriaan Davel

          Because people are still looking for a silver-bullet, 1 thing that can do everything for you. Would hate to see the design & architecture of the rest of the 'solution'

          ____________________________________________________________ Be brave little warrior, be VERY brave

          T Offline
          T Offline
          thrakazog
          wrote on last edited by
          #11

          Design? Architecture? Not on this project man! ;P

          Play my game Gravity: IOS[^], Android[^], Windows Phone 7[^]

          1 Reply Last reply
          0
          • T thrakazog

            ALTER PROCEDURE [dbo].[arUpdate]
            @intForecastID int,
            @strForecastName varchar(18),
            @strBillTo varchar(12),
            @strPOCName varchar(50),
            @strPOCEmail varchar(100),
            @strModifiedBy varchar(20),
            @strComment varchar(3000),
            @strDelMaterials varchar(8000),
            @strData1 varchar(8000),
            @strData2 varchar(8000),
            @strData3 varchar(8000),
            @strData4 varchar(8000),
            @strData5 varchar(8000),
            @strData6 varchar(8000),
            @strData7 varchar(8000),
            @strData8 varchar(8000),
            @strData9 varchar(8000),
            @strData10 varchar(8000),
            @strData11 varchar(8000),
            @strData12 varchar(8000),
            @strData13 varchar(8000),
            @strData14 varchar(8000),
            @strData15 varchar(8000),
            @strData16 varchar(8000),
            @strData17 varchar(8000),
            @strData18 varchar(8000),
            @strData19 varchar(8000),
            @strData20 varchar(8000)

            :wtf: None of the code in this procedure or from the calling methods looked any better. The data going into the varchar(8000) fields was delimited with a grab bag combination of special characters. Which was then pealed apart using cursors. :wtf:

            Play my game Gravity: IOS[^], Android[^], Windows Phone 7[^]

            M Offline
            M Offline
            mmelvis
            wrote on last edited by
            #12

            You have an application that is 25 years old with no documentation for the tables, c-isam tables. You have to make this wonderful application talk to a modern day databases. You have been given a budget of $0 to get this task completed. You have just enough time to learn syntax to put something together that will hopefully work. That is how this happens.

            T 1 Reply Last reply
            0
            • T thrakazog

              ALTER PROCEDURE [dbo].[arUpdate]
              @intForecastID int,
              @strForecastName varchar(18),
              @strBillTo varchar(12),
              @strPOCName varchar(50),
              @strPOCEmail varchar(100),
              @strModifiedBy varchar(20),
              @strComment varchar(3000),
              @strDelMaterials varchar(8000),
              @strData1 varchar(8000),
              @strData2 varchar(8000),
              @strData3 varchar(8000),
              @strData4 varchar(8000),
              @strData5 varchar(8000),
              @strData6 varchar(8000),
              @strData7 varchar(8000),
              @strData8 varchar(8000),
              @strData9 varchar(8000),
              @strData10 varchar(8000),
              @strData11 varchar(8000),
              @strData12 varchar(8000),
              @strData13 varchar(8000),
              @strData14 varchar(8000),
              @strData15 varchar(8000),
              @strData16 varchar(8000),
              @strData17 varchar(8000),
              @strData18 varchar(8000),
              @strData19 varchar(8000),
              @strData20 varchar(8000)

              :wtf: None of the code in this procedure or from the calling methods looked any better. The data going into the varchar(8000) fields was delimited with a grab bag combination of special characters. Which was then pealed apart using cursors. :wtf:

              Play my game Gravity: IOS[^], Android[^], Windows Phone 7[^]

              E Offline
              E Offline
              exmsde
              wrote on last edited by
              #13

              I see this and I think "Why did I enable it? Why did I agree to varchar(8000)? I could have stopped it. I could have kept Sybase's 255 character limit. I could have...." Ah the law of unintended consequences.

              1 Reply Last reply
              0
              • M mmelvis

                You have an application that is 25 years old with no documentation for the tables, c-isam tables. You have to make this wonderful application talk to a modern day databases. You have been given a budget of $0 to get this task completed. You have just enough time to learn syntax to put something together that will hopefully work. That is how this happens.

                T Offline
                T Offline
                thrakazog
                wrote on last edited by
                #14

                I could see it happening that way sometimes. But this code was from an ASP.net app. The comments put the creation date of this piece around 2005. This may have come about through code rot. Maybe it worked great for something small and the scope and input string kept expanding. In any case... ick. And of course I don't have the time to fix it either. So I'll pass it on to somebody else also.

                Play my game Gravity: IOS[^], Android[^], Windows Phone 7[^]

                1 Reply Last reply
                0
                • S SomeGuyThatIsMe

                  I have that exact same pattern in my DB(not done by me), i wonder if they were both written by the same person. In my version though all those varchar(8000)s are ignored in the first SP and passed to a second which does even more string manipulation with cursors. wonder why they just didnt use one varchar(max) or a text field.

                  Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

                  K Offline
                  K Offline
                  KP Lee
                  wrote on last edited by
                  #15

                  SomeGuyThatIsMe wrote:

                  wonder why they just didnt use one varchar(max) or a text field.

                  I'd guess this was written in SQL 2000. max didn't exist and it took too much thinking to do character manipulation on text fields. (For anyone who'd write this in the first place.) I can't picture how to execute a cursor on a varchar field. (Extract a fraction of the data and then use a cursor to retrieve it from a table, sure, but ON the field?)

                  S 1 Reply Last reply
                  0
                  • K KP Lee

                    SomeGuyThatIsMe wrote:

                    wonder why they just didnt use one varchar(max) or a text field.

                    I'd guess this was written in SQL 2000. max didn't exist and it took too much thinking to do character manipulation on text fields. (For anyone who'd write this in the first place.) I can't picture how to execute a cursor on a varchar field. (Extract a fraction of the data and then use a cursor to retrieve it from a table, sure, but ON the field?)

                    S Offline
                    S Offline
                    SomeGuyThatIsMe
                    wrote on last edited by
                    #16

                    If i find the time today i'll post that piece of the sp.

                    Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

                    1 Reply Last reply
                    0
                    • T thrakazog

                      ALTER PROCEDURE [dbo].[arUpdate]
                      @intForecastID int,
                      @strForecastName varchar(18),
                      @strBillTo varchar(12),
                      @strPOCName varchar(50),
                      @strPOCEmail varchar(100),
                      @strModifiedBy varchar(20),
                      @strComment varchar(3000),
                      @strDelMaterials varchar(8000),
                      @strData1 varchar(8000),
                      @strData2 varchar(8000),
                      @strData3 varchar(8000),
                      @strData4 varchar(8000),
                      @strData5 varchar(8000),
                      @strData6 varchar(8000),
                      @strData7 varchar(8000),
                      @strData8 varchar(8000),
                      @strData9 varchar(8000),
                      @strData10 varchar(8000),
                      @strData11 varchar(8000),
                      @strData12 varchar(8000),
                      @strData13 varchar(8000),
                      @strData14 varchar(8000),
                      @strData15 varchar(8000),
                      @strData16 varchar(8000),
                      @strData17 varchar(8000),
                      @strData18 varchar(8000),
                      @strData19 varchar(8000),
                      @strData20 varchar(8000)

                      :wtf: None of the code in this procedure or from the calling methods looked any better. The data going into the varchar(8000) fields was delimited with a grab bag combination of special characters. Which was then pealed apart using cursors. :wtf:

                      Play my game Gravity: IOS[^], Android[^], Windows Phone 7[^]

                      T Offline
                      T Offline
                      thomas michaud
                      wrote on last edited by
                      #17

                      I've seen code like that were they were manipulating data -- usually because they couldn't (normally they just didn't want to) use better tools. But I'm worried about this line -- Which was then pealed apart using cursors. Cursors?

                      1 Reply Last reply
                      0
                      • T thrakazog

                        ALTER PROCEDURE [dbo].[arUpdate]
                        @intForecastID int,
                        @strForecastName varchar(18),
                        @strBillTo varchar(12),
                        @strPOCName varchar(50),
                        @strPOCEmail varchar(100),
                        @strModifiedBy varchar(20),
                        @strComment varchar(3000),
                        @strDelMaterials varchar(8000),
                        @strData1 varchar(8000),
                        @strData2 varchar(8000),
                        @strData3 varchar(8000),
                        @strData4 varchar(8000),
                        @strData5 varchar(8000),
                        @strData6 varchar(8000),
                        @strData7 varchar(8000),
                        @strData8 varchar(8000),
                        @strData9 varchar(8000),
                        @strData10 varchar(8000),
                        @strData11 varchar(8000),
                        @strData12 varchar(8000),
                        @strData13 varchar(8000),
                        @strData14 varchar(8000),
                        @strData15 varchar(8000),
                        @strData16 varchar(8000),
                        @strData17 varchar(8000),
                        @strData18 varchar(8000),
                        @strData19 varchar(8000),
                        @strData20 varchar(8000)

                        :wtf: None of the code in this procedure or from the calling methods looked any better. The data going into the varchar(8000) fields was delimited with a grab bag combination of special characters. Which was then pealed apart using cursors. :wtf:

                        Play my game Gravity: IOS[^], Android[^], Windows Phone 7[^]

                        N Offline
                        N Offline
                        Nitin S
                        wrote on last edited by
                        #18

                        :~:~:~

                        ============================================ The grass is always greener on the other side of the fence

                        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