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. stored procedures

stored procedures

Scheduled Pinned Locked Moved The Lounge
questioncareer
25 Posts 16 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.
  • W wolfbinary

    Has anyone come across a job where they actively refuse to use stored procedures? I'm trying to understand what the rational is.

    X Offline
    X Offline
    Xiangyang Liu
    wrote on last edited by
    #2

    The third party product we are using right now has thousands of tables, not a single stored procedure.

    wolfbinary wrote:

    I'm trying to understand what the rational is.

    I think they were trying to make their product portable (between different databases).

    My .NET Business Application Framework My Home Page My Younger Son & His "PET"

    M 1 Reply Last reply
    0
    • X Xiangyang Liu

      The third party product we are using right now has thousands of tables, not a single stored procedure.

      wolfbinary wrote:

      I'm trying to understand what the rational is.

      I think they were trying to make their product portable (between different databases).

      My .NET Business Application Framework My Home Page My Younger Son & His "PET"

      M Offline
      M Offline
      Michael Bookatz
      wrote on last edited by
      #3

      Xiangyang Liu ??? wrote:

      I think they were trying to making their product portable (between different databases).

      But correct me if I'm wrong most Databases out there (the big ones at least) all use SP's?

      X C 2 Replies Last reply
      0
      • M Michael Bookatz

        Xiangyang Liu ??? wrote:

        I think they were trying to making their product portable (between different databases).

        But correct me if I'm wrong most Databases out there (the big ones at least) all use SP's?

        X Offline
        X Offline
        Xiangyang Liu
        wrote on last edited by
        #4

        hopingToCode wrote:

        But correct me if I'm wrong most Databases out there (the big ones at least) all use SP's?

        Can you take source code of stored procedures for one database, say SQL Server, and use on another, say Oracle?

        My .NET Business Application Framework My Home Page My Younger Son & His "PET"

        D 1 Reply Last reply
        0
        • W wolfbinary

          Has anyone come across a job where they actively refuse to use stored procedures? I'm trying to understand what the rational is.

          N Offline
          N Offline
          Nemanja Trifunovic
          wrote on last edited by
          #5

          At my previous job we were using MySQL ( X| ) and when we finally upgraded to a version that supports stored procedures there was an incentive from some developers to use them, but the boss didn't let it happen. He was afraid the DBA would play with the stored procedures and break something.

          Programming Blog utf8-cpp

          X 1 Reply Last reply
          0
          • N Nemanja Trifunovic

            At my previous job we were using MySQL ( X| ) and when we finally upgraded to a version that supports stored procedures there was an incentive from some developers to use them, but the boss didn't let it happen. He was afraid the DBA would play with the stored procedures and break something.

            Programming Blog utf8-cpp

            X Offline
            X Offline
            Xiangyang Liu
            wrote on last edited by
            #6

            Nemanja Trifunovic wrote:

            He was afraid the DBA would play with the stored procedures and break something.

            Wow, at my company it always the DBA is afraid of others breaking something.

            My .NET Business Application Framework My Home Page My Younger Son & His "PET"

            N 1 Reply Last reply
            0
            • M Michael Bookatz

              Xiangyang Liu ??? wrote:

              I think they were trying to making their product portable (between different databases).

              But correct me if I'm wrong most Databases out there (the big ones at least) all use SP's?

              C Offline
              C Offline
              Chris Losinger
              wrote on last edited by
              #7

              up until v5, MySQL didn't have any stoProc support.

              batch image processing

              1 Reply Last reply
              0
              • W wolfbinary

                Has anyone come across a job where they actively refuse to use stored procedures? I'm trying to understand what the rational is.

                M Offline
                M Offline
                Miszou
                wrote on last edited by
                #8

                Yes, and I left shortly afterwards. The reasoning was that the database might one day be changed from say SQL Server to something like Oracle or Access, and stored procedures might no longer work on the new system. In actuality, even very simple queries can vary greatly between different DBMS's, so you're still going to have to modify everything - only now it's all hard-coded into all your applications and is a total PITA. For example, the following query in SQL Server will not work in PostGres: select top 1 * from Customers order by CustomerID You have to turn it into something like this: select * from Customers order by CustomerID limit 1 If you want to have a completely database agnostic application, you're going to need to use a middle layer to translate calls between your application and the database. We are using DevForce from IdeaBlade[^], and it works really well. Of course, we have no plans to change the underlying database but if we had to, then it would be a hell of a lot easier with DevForce managing everything! To summarize, IMHO there is no reason not to use stored procedures in a system that supports them, and there are many benefits to be gained when you do use them.

                The StartPage Randomizer - The Windows Cheerleader - Twitter

                1 Reply Last reply
                0
                • X Xiangyang Liu

                  hopingToCode wrote:

                  But correct me if I'm wrong most Databases out there (the big ones at least) all use SP's?

                  Can you take source code of stored procedures for one database, say SQL Server, and use on another, say Oracle?

                  My .NET Business Application Framework My Home Page My Younger Son & His "PET"

                  D Offline
                  D Offline
                  daniilzol
                  wrote on last edited by
                  #9

                  As far as I know only the most basic syntax will be portable such as select ... from ... where ... Proprietary T-SQL syntax from Microsoft is not compatible with PL\SQL.

                  S 1 Reply Last reply
                  0
                  • X Xiangyang Liu

                    Nemanja Trifunovic wrote:

                    He was afraid the DBA would play with the stored procedures and break something.

                    Wow, at my company it always the DBA is afraid of others breaking something.

                    My .NET Business Application Framework My Home Page My Younger Son & His "PET"

                    N Offline
                    N Offline
                    Nemanja Trifunovic
                    wrote on last edited by
                    #10

                    Xiangyang Liu ??? wrote:

                    Wow, at my company it always the DBA is afraid of others breaking something

                    Well, it often works both ways - everybody is afraid of other people breaking something :)

                    Programming Blog utf8-cpp

                    1 Reply Last reply
                    0
                    • W wolfbinary

                      Has anyone come across a job where they actively refuse to use stored procedures? I'm trying to understand what the rational is.

                      E Offline
                      E Offline
                      Edw
                      wrote on last edited by
                      #11

                      In a previous life we used SQL Server CE, and it didn't support stored procedures. We also made the decision to reuse the embedded CE C# code on the desktop platform (write once, use in both places). So we ended up with a desktop system that couldn't use stored procedures either.

                      1 Reply Last reply
                      0
                      • W wolfbinary

                        Has anyone come across a job where they actively refuse to use stored procedures? I'm trying to understand what the rational is.

                        P Offline
                        P Offline
                        PIEBALDconsult
                        wrote on last edited by
                        #12

                        Maybe "General IT discussions" or "General Database discussions" would be a more appropriate forum. "They" the company? No. Well, wait, maybe... Rather than get into a dissertation on why I personally don't write stored procedures, I'll simply answer the question: There was one company that not only didn't have referential integrity on the production databases, but wouldn't even allow me to write functions in the database because, "the metadata would bog down the database". I assume that if the database supported stored procedures, they wouldn't use them either (this was in 2001, using RDB on OpenVMS). I knew that having the functions I wanted would greatly improve the performance of what I was writing, so I had my program create the functions it needed and drop them when it was done. :-D

                        1 Reply Last reply
                        0
                        • W wolfbinary

                          Has anyone come across a job where they actively refuse to use stored procedures? I'm trying to understand what the rational is.

                          J Offline
                          J Offline
                          Jon Sagara
                          wrote on last edited by
                          #13

                          Perhaps they read this blog entry[^]. :)

                          Jon Sagara Some see the glass as half-empty, some see the glass as half-full. I see the glass as too big. -- George Carlin .NET Blog | Personal Blog | Articles

                          P W 2 Replies Last reply
                          0
                          • J Jon Sagara

                            Perhaps they read this blog entry[^]. :)

                            Jon Sagara Some see the glass as half-empty, some see the glass as half-full. I see the glass as too big. -- George Carlin .NET Blog | Personal Blog | Articles

                            P Offline
                            P Offline
                            PIEBALDconsult
                            wrote on last edited by
                            #14

                            Oh, good, thanks. I lost that link when I got laid off. There was another one too.

                            1 Reply Last reply
                            0
                            • W wolfbinary

                              Has anyone come across a job where they actively refuse to use stored procedures? I'm trying to understand what the rational is.

                              E Offline
                              E Offline
                              ednrg
                              wrote on last edited by
                              #15

                              I haven't myself, but I have heard of this. Usually, it's due to the fact that the existing staff do not know how to program, or even what SPs are.

                              1 Reply Last reply
                              0
                              • J Jon Sagara

                                Perhaps they read this blog entry[^]. :)

                                Jon Sagara Some see the glass as half-empty, some see the glass as half-full. I see the glass as too big. -- George Carlin .NET Blog | Personal Blog | Articles

                                W Offline
                                W Offline
                                wolfbinary
                                wrote on last edited by
                                #16

                                I think its about control more than anything. The last place I was at did this and it was dreadful to read through the code. They eventually moved some code to the DB so it wouldn't time out. Here it is a bit weird. I think it's a control issue again.

                                1 Reply Last reply
                                0
                                • D daniilzol

                                  As far as I know only the most basic syntax will be portable such as select ... from ... where ... Proprietary T-SQL syntax from Microsoft is not compatible with PL\SQL.

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

                                  You are right but not only the syntax, also the code organization is completely different. In Oracle using a top-level functions and procedures /outside the packages/ is considered like very bad practice.

                                  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.

                                  1 Reply Last reply
                                  0
                                  • W wolfbinary

                                    Has anyone come across a job where they actively refuse to use stored procedures? I'm trying to understand what the rational is.

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

                                    My current employer refuses to use stored procedures - despite me literally begging. Their reason - the existing developers (2 of) haven't used them before, and don't understand / know how to write them. They also seem to think that it wouldn't be possible to write stored procedures to cover certain cases - where they are building SQL on the fly - but in 99% of cases this is because the are as thick as 2π_E_/v

                                    ___________________________________________ .\\axxx (That's an 'M')

                                    V 1 Reply Last reply
                                    0
                                    • L Lost User

                                      My current employer refuses to use stored procedures - despite me literally begging. Their reason - the existing developers (2 of) haven't used them before, and don't understand / know how to write them. They also seem to think that it wouldn't be possible to write stored procedures to cover certain cases - where they are building SQL on the fly - but in 99% of cases this is because the are as thick as 2π_E_/v

                                      ___________________________________________ .\\axxx (That's an 'M')

                                      V Offline
                                      V Offline
                                      vaghelabhavesh
                                      wrote on last edited by
                                      #19

                                      Maxxx_ wrote:

                                      My current employer refuses to use stored procedures - despite me literally begging.

                                      Isn't SPs are faster than queries in code? And also you can save some round trips from code to db.

                                      Be careful, there is no Undo Button(Ctrl+Z) in life.

                                      L 1 Reply Last reply
                                      0
                                      • W wolfbinary

                                        Has anyone come across a job where they actively refuse to use stored procedures? I'm trying to understand what the rational is.

                                        J Offline
                                        J Offline
                                        Joe Woodbury
                                        wrote on last edited by
                                        #20

                                        Not a SQL guy, but at my last two companies there wasn't an absolute ban, just a "keep them to a minimum and make sure they're really justified" rule. The issue being that stored procedures have big impacts on scalability. Why have the server do something the client could be doing?

                                        Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke

                                        P 1 Reply Last reply
                                        0
                                        • V vaghelabhavesh

                                          Maxxx_ wrote:

                                          My current employer refuses to use stored procedures - despite me literally begging.

                                          Isn't SPs are faster than queries in code? And also you can save some round trips from code to db.

                                          Be careful, there is no Undo Button(Ctrl+Z) in life.

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

                                          crudeCodeYogi wrote:

                                          sn't SPs are faster than queries in code

                                          No - not necessarily.

                                          crudeCodeYogi wrote:

                                          you can save some round trips from code to db

                                          Sometimes. My summary of the pros and cons is this: Comparing SP with simply hand-coding the SQL in the application, there's little doubt that SPs are preferable - they can be tested independently, tweaked for efficiency etc. without an application change. There can be run-time efficiencies in using SPs but these are (generally) not significant. Using some sort of automatic SQL generation layer in the application seems to be the 'solution' to not using stored procedures. I guess this is fine (I imagine the layer using reflection to look at an object, converting each property into a field on the insert - possibly using attributes to determine the column names and any special functionality pertinent to that field. However - developing this layer is, I think, complex and time consuming. If you re-use the layer then I guess it can save development time - but I like to split projects between developers, so my DBA can develop stored procs - the interface is agreed between the software developer and the DBA - then I don't care how he does it - as long as the Stored Proc sores and retrieves the information I need, efficiently. My fear of 'automatic' sql generation is in the exceptions that come along - leading to a more complex layer, harder to debug if something goes wrong. With a SP, i can easily identify bottlenecks, and have them easily looked at independently of the application. I can then oftentimes modify the SPs on the production system without the need to redeploy my application.

                                          ___________________________________________ .\\axxx (That's an 'M')

                                          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