SQL in ADO.NET vs Stored Procedure

  • We are having a discussion on the which is "better": To code sql statements within .NET compiled application using ADO.NET or to code sql statements in stored procedures and call the stored procedures. We are assuming that each has its own performance/maintainability issues, so "better" will be relative. Any thoughts will be appreciated.

    Gordon Pollokoff

    "Wile E. is my reality, Bugs Bunny is my goal" - Chuck Jones

  • Stored procedures are much more maintainable, require less network traffic to transmit commands, and allow permissions to be more finely controlled. Just make sure you put together some sort of Source control for your procs.

  • Another vote for Stored Procedures. There are times when the SQL is dynamic enough to be done "better" from another tier, but when the parameters and output are known and consistent, Procedures are always my choice. My personal preference (I think this is also what you hinted, jpipes) is to keep the source procedure code in files maintained by a source code control system and NOT edit them directly through EM.

    Guarddata-

  • Have to agree to use Stored Procedures if possible.

    In my opinion, Maintainability is not necessarily an advantage of Stored procedures. You might / will be distributing 'Business Logic' over two tiers, which should be avoided, if possible.

    But the gain in performance and limitation of network traffic is an obvious advantage.

    It is also easier to 'hide' database implementation when using procedures.

    VERY BIG DISADVANTAGE :

    Code portability. Don't count on(don't think about, that is) porting your application to different databases. Just think about the differences in SP syntax between Oracle and SQL server, and then we're not even talking about mySQL (no stored procedures), Access (no support for SQL-syntax either), and so on ...

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply