Stored Procedures vs. Ad-hoc SQL Redux
I’ve written on the never-ending stored procs vs. ad-hoc SQL debate before, but there are quite a few more perspectives on both sides of it than I referred to in my previous post. Here are a few of them:
- Frans Bouma (ad-hoc SQL camp) compiles a summary post with links to various arguments here.
- Jeremy D. Miller (ad-hoc SQL camp) rejects stored procedures because they make test-driven development (TDD) slower. This is an argument I hadn't thought of. The apps I build tend to be database-driven websites. Testing logic that makes database calls at any point does slow things down quite a bit. Miller especially dislikes the idea of putting business logic into a stored procedure (defined as anything other than a CRUD operation).
- Jeff Atwood (ad-hoc SQL camp) argues against stored procedures because he prefers parameterized SQL and a single development environment.
- Microsoft's official guidance is to use stored procedures instead of direct SQL.
- Rob Howard writes in favor of stored procedures. Community Server 2.1 makes significant use of them.