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. Attack of the stord proc

Attack of the stord proc

Scheduled Pinned Locked Moved The Weird and The Wonderful
helptutorialquestion
13 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.
  • V Offline
    V Offline
    virang_21
    wrote on last edited by
    #1

    I have this project which is so nasty I don't even want to touch it but as a jock on my professional life I inherited it from a master developers. Application is so pathatically written it makes my mind go crazy whenever there is a fix required. So here is one example of hundreds of stord proc it uses or not uses ( some stord proc are just there for fun :mad:).

    CREATE PROCEDURE [dbo].[uspInsertUpdateDeleteFltcode]
    @fltCode varchar(8),@fltDesc Varchar(20),@fltGrp varchar(8),@casterRelated bit,
    @fltType varchar(2),@flag char(1),@shortDesc Varchar(8),@rptOrd Numeric(9,0)
    AS
    declare @Operation char(1)

    BEGIN
    SET NOCOUNT ON;
    SET @operation=@flag
    IF @operation='I'
    BEGIN
    INSERT INTO FltCode (Flt_Code,Flt_Desc,Flt_Grp,Caster_Related,Flt_Type,Sh_Desc,Rpt_Ord)
    VALUES(@fltCode,@fltDesc,@fltGrp,@casterRelated,@fltType,@shortDesc,@rptOrd)
    END
    IF @operation='U'
    BEGIN
    ....
    ...
    ..

    Some of them call some other stord procs internally. Some are at least 500 lines long and loop within loop within loop and so on but this is insane why in the world you have one strod proc that do every CURD operation ? Why ..:mad:

    Zen and the art of software maintenance : rm -rf * Math is like love : a simple idea but it can get complicated.

    M L P 3 Replies Last reply
    0
    • V virang_21

      I have this project which is so nasty I don't even want to touch it but as a jock on my professional life I inherited it from a master developers. Application is so pathatically written it makes my mind go crazy whenever there is a fix required. So here is one example of hundreds of stord proc it uses or not uses ( some stord proc are just there for fun :mad:).

      CREATE PROCEDURE [dbo].[uspInsertUpdateDeleteFltcode]
      @fltCode varchar(8),@fltDesc Varchar(20),@fltGrp varchar(8),@casterRelated bit,
      @fltType varchar(2),@flag char(1),@shortDesc Varchar(8),@rptOrd Numeric(9,0)
      AS
      declare @Operation char(1)

      BEGIN
      SET NOCOUNT ON;
      SET @operation=@flag
      IF @operation='I'
      BEGIN
      INSERT INTO FltCode (Flt_Code,Flt_Desc,Flt_Grp,Caster_Related,Flt_Type,Sh_Desc,Rpt_Ord)
      VALUES(@fltCode,@fltDesc,@fltGrp,@casterRelated,@fltType,@shortDesc,@rptOrd)
      END
      IF @operation='U'
      BEGIN
      ....
      ...
      ..

      Some of them call some other stord procs internally. Some are at least 500 lines long and loop within loop within loop and so on but this is insane why in the world you have one strod proc that do every CURD operation ? Why ..:mad:

      Zen and the art of software maintenance : rm -rf * Math is like love : a simple idea but it can get complicated.

      M Offline
      M Offline
      Manfred Rudolf Bihy
      wrote on last edited by
      #2

      virang_21 wrote:

      jock on my professional

      So you think you're some jock[^]. I believe it's more like a joke. ;P

      virang_21 wrote:

      pathatically

      Your spelling is quite pathetic. :-D

      virang_21 wrote:

      other stord procs internally

      So how does a town in Norway[^] figure into all this? :laugh:

      virang_21 wrote:

      have one strod

      An what's this bit with that Russian civil war hero[^]?

      virang_21 wrote:

      every CURD[^] operation

      Hmmm,makes me think of cheese. I wonder why? :rolleyes: I'm trying to figure out real hard what really belongs into the hall of shame here. :doh: Cheers!

      "With sufficient thrust, pigs fly just fine."

      Ross Callon, The Twelve Networking Truths, RFC1925

      V P 2 Replies Last reply
      0
      • V virang_21

        I have this project which is so nasty I don't even want to touch it but as a jock on my professional life I inherited it from a master developers. Application is so pathatically written it makes my mind go crazy whenever there is a fix required. So here is one example of hundreds of stord proc it uses or not uses ( some stord proc are just there for fun :mad:).

        CREATE PROCEDURE [dbo].[uspInsertUpdateDeleteFltcode]
        @fltCode varchar(8),@fltDesc Varchar(20),@fltGrp varchar(8),@casterRelated bit,
        @fltType varchar(2),@flag char(1),@shortDesc Varchar(8),@rptOrd Numeric(9,0)
        AS
        declare @Operation char(1)

        BEGIN
        SET NOCOUNT ON;
        SET @operation=@flag
        IF @operation='I'
        BEGIN
        INSERT INTO FltCode (Flt_Code,Flt_Desc,Flt_Grp,Caster_Related,Flt_Type,Sh_Desc,Rpt_Ord)
        VALUES(@fltCode,@fltDesc,@fltGrp,@casterRelated,@fltType,@shortDesc,@rptOrd)
        END
        IF @operation='U'
        BEGIN
        ....
        ...
        ..

        Some of them call some other stord procs internally. Some are at least 500 lines long and loop within loop within loop and so on but this is insane why in the world you have one strod proc that do every CURD operation ? Why ..:mad:

        Zen and the art of software maintenance : rm -rf * Math is like love : a simple idea but it can get complicated.

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

        virang_21 wrote:

        Some are at least 500 lines long and loop within loop within loop and so on but this is insane why in the world you have one strod proc that do every CURD operation ? Why .

        For fun, I do not see any other 'advantages'. Nice prefixes - must have been written by a VB6-programmer :)

        Bastard Programmer from Hell :suss:

        L P 2 Replies Last reply
        0
        • M Manfred Rudolf Bihy

          virang_21 wrote:

          jock on my professional

          So you think you're some jock[^]. I believe it's more like a joke. ;P

          virang_21 wrote:

          pathatically

          Your spelling is quite pathetic. :-D

          virang_21 wrote:

          other stord procs internally

          So how does a town in Norway[^] figure into all this? :laugh:

          virang_21 wrote:

          have one strod

          An what's this bit with that Russian civil war hero[^]?

          virang_21 wrote:

          every CURD[^] operation

          Hmmm,makes me think of cheese. I wonder why? :rolleyes: I'm trying to figure out real hard what really belongs into the hall of shame here. :doh: Cheers!

          "With sufficient thrust, pigs fly just fine."

          Ross Callon, The Twelve Networking Truths, RFC1925

          V Offline
          V Offline
          virang_21
          wrote on last edited by
          #4

          yea mate ... after long debug spelling doesn't matter much.. and English ( Engrish ) is not my first language.. I still swear in my mother tongue when I am frustrated...

          Zen and the art of software maintenance : rm -rf * Math is like love : a simple idea but it can get complicated.

          1 Reply Last reply
          0
          • L Lost User

            virang_21 wrote:

            Some are at least 500 lines long and loop within loop within loop and so on but this is insane why in the world you have one strod proc that do every CURD operation ? Why .

            For fun, I do not see any other 'advantages'. Nice prefixes - must have been written by a VB6-programmer :)

            Bastard Programmer from Hell :suss:

            L Offline
            L Offline
            loctrice
            wrote on last edited by
            #5

            Eddy Vluggen wrote:

            must have been written by a VB6-programmer

            This joke is less and less funny when you know, work with, and refactor code by vb6 programmers :doh:

            If it moves, compile it

            L 1 Reply Last reply
            0
            • M Manfred Rudolf Bihy

              virang_21 wrote:

              jock on my professional

              So you think you're some jock[^]. I believe it's more like a joke. ;P

              virang_21 wrote:

              pathatically

              Your spelling is quite pathetic. :-D

              virang_21 wrote:

              other stord procs internally

              So how does a town in Norway[^] figure into all this? :laugh:

              virang_21 wrote:

              have one strod

              An what's this bit with that Russian civil war hero[^]?

              virang_21 wrote:

              every CURD[^] operation

              Hmmm,makes me think of cheese. I wonder why? :rolleyes: I'm trying to figure out real hard what really belongs into the hall of shame here. :doh: Cheers!

              "With sufficient thrust, pigs fly just fine."

              Ross Callon, The Twelve Networking Truths, RFC1925

              P Offline
              P Offline
              Pascal Ganaye
              wrote on last edited by
              #6

              This post made me laugh. It's not his native language neither mine for that matter. No shame there, the guy is frustrated.

              1 Reply Last reply
              0
              • L loctrice

                Eddy Vluggen wrote:

                must have been written by a VB6-programmer

                This joke is less and less funny when you know, work with, and refactor code by vb6 programmers :doh:

                If it moves, compile it

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

                loctrice wrote:

                This joke is less and less funny when you know, work with, and refactor code by vb6 programmers :doh:

                It's not a joke, it's sarcasm. Those prefixes are heavily in use by both Access (VBA) and VB6 developers. You won't see these kind of examples in a book on Sql. Most "experienced" programmers that I worked with are multi-lingual and rarely label themselves using a certain language. ..and yes, I too, worked a lot with VB6. The Professional edition! :rolleyes:

                Bastard Programmer from Hell :suss:

                1 Reply Last reply
                0
                • L Lost User

                  virang_21 wrote:

                  Some are at least 500 lines long and loop within loop within loop and so on but this is insane why in the world you have one strod proc that do every CURD operation ? Why .

                  For fun, I do not see any other 'advantages'. Nice prefixes - must have been written by a VB6-programmer :)

                  Bastard Programmer from Hell :suss:

                  P Offline
                  P Offline
                  Pascal Ganaye
                  wrote on last edited by
                  #8

                  Type prefixing is far more common in C++ than VB. http://en.wikipedia.org/wiki/Hungarian_notation[^]

                  L 1 Reply Last reply
                  0
                  • V virang_21

                    I have this project which is so nasty I don't even want to touch it but as a jock on my professional life I inherited it from a master developers. Application is so pathatically written it makes my mind go crazy whenever there is a fix required. So here is one example of hundreds of stord proc it uses or not uses ( some stord proc are just there for fun :mad:).

                    CREATE PROCEDURE [dbo].[uspInsertUpdateDeleteFltcode]
                    @fltCode varchar(8),@fltDesc Varchar(20),@fltGrp varchar(8),@casterRelated bit,
                    @fltType varchar(2),@flag char(1),@shortDesc Varchar(8),@rptOrd Numeric(9,0)
                    AS
                    declare @Operation char(1)

                    BEGIN
                    SET NOCOUNT ON;
                    SET @operation=@flag
                    IF @operation='I'
                    BEGIN
                    INSERT INTO FltCode (Flt_Code,Flt_Desc,Flt_Grp,Caster_Related,Flt_Type,Sh_Desc,Rpt_Ord)
                    VALUES(@fltCode,@fltDesc,@fltGrp,@casterRelated,@fltType,@shortDesc,@rptOrd)
                    END
                    IF @operation='U'
                    BEGIN
                    ....
                    ...
                    ..

                    Some of them call some other stord procs internally. Some are at least 500 lines long and loop within loop within loop and so on but this is insane why in the world you have one strod proc that do every CURD operation ? Why ..:mad:

                    Zen and the art of software maintenance : rm -rf * Math is like love : a simple idea but it can get complicated.

                    P Offline
                    P Offline
                    Pascal Ganaye
                    wrote on last edited by
                    #9

                    Again I am playing devil's advocate here. I am not suggesting that you should write this code. However Sometime the DBA through SQL user access rights settings won't let program access the database through SELECT/INSERT/UPDATE statements but allow execution of stored procedures. In those scenario you must use STORED procedures to do anything.

                    V 1 Reply Last reply
                    0
                    • P Pascal Ganaye

                      Type prefixing is far more common in C++ than VB. http://en.wikipedia.org/wiki/Hungarian_notation[^]

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

                      Pascal Ganaye wrote:

                      Type prefixing is far more common in C++ than VB.

                      Granted; and Apps Hungarian is still in use, with a good reason. Systems Hungarian has been abandoned, also with a good reason. It's not a problem to have used it, but it IS a problem if you still see a modern-day use. Especially since the argument is over ten years old. ..and ffs, why in Sql? Is it really that complex code? No, it simply someone religiously following his "coding standard".

                      Bastard Programmer from Hell :suss:

                      J 1 Reply Last reply
                      0
                      • P Pascal Ganaye

                        Again I am playing devil's advocate here. I am not suggesting that you should write this code. However Sometime the DBA through SQL user access rights settings won't let program access the database through SELECT/INSERT/UPDATE statements but allow execution of stored procedures. In those scenario you must use STORED procedures to do anything.

                        V Offline
                        V Offline
                        virang_21
                        wrote on last edited by
                        #11

                        I don't mind use of stored proc.. It is terrible when INSERT/UPDATE/DELETE done in the same stored proc and code is calling the same stored proc with only way to find what operation it is doing is via flag is a big fat FAIL !!!

                        Zen and the art of software maintenance : rm -rf * Math is like love : a simple idea but it can get complicated.

                        1 Reply Last reply
                        0
                        • L Lost User

                          Pascal Ganaye wrote:

                          Type prefixing is far more common in C++ than VB.

                          Granted; and Apps Hungarian is still in use, with a good reason. Systems Hungarian has been abandoned, also with a good reason. It's not a problem to have used it, but it IS a problem if you still see a modern-day use. Especially since the argument is over ten years old. ..and ffs, why in Sql? Is it really that complex code? No, it simply someone religiously following his "coding standard".

                          Bastard Programmer from Hell :suss:

                          J Offline
                          J Offline
                          Jan Steyn
                          wrote on last edited by
                          #12

                          Sometimes because "Our Dear Leader" dictated that all stored procs shall be prefixed with

                          sp_

                          :wtf: at least I could convince him that we should use

                          usp_

                          , with difficulty... Sys Hungarian is also common throughout the system, such that

                          Dim iVariable As String

                          also happens to be a common sight :sigh:

                          L 1 Reply Last reply
                          0
                          • J Jan Steyn

                            Sometimes because "Our Dear Leader" dictated that all stored procs shall be prefixed with

                            sp_

                            :wtf: at least I could convince him that we should use

                            usp_

                            , with difficulty... Sys Hungarian is also common throughout the system, such that

                            Dim iVariable As String

                            also happens to be a common sight :sigh:

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

                            Whehe, aight :-D The last example shows how it does more damage than good. I've seen these quite often, and it costs more time than that it actually helps. Was I right in my guess? And if I also guess he's Dutch?

                            Bastard Programmer from Hell :suss:

                            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