Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 399363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:50:21+00:00 2026-05-12T16:50:21+00:00

How generic should you make your stored procedures? Should they be considered one hit

  • 0

How generic should you make your stored procedures? Should they be considered “one hit” or mirror more general use? Consider the following cases:

1.

  • FindUser(username, …)

    Stored procedure returns the user id to the caller

  • FindItem(itemname, …)

    Store procedure reurns the item id to the caller

  • AddOrder(userid, itemid, …)

    The returned ids can then be passed to the third stored procedure

2.

  • AddOrder(username, itemname, …)

Here, the lookup for ids is done inside the stored procedure

Is there a preferred/recommended way? Thank you for your thoughts.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T16:50:21+00:00Added an answer on May 12, 2026 at 4:50 pm

    Don’t fall into the trap of thinking that having to manage/maintain many simple procs is more difficult then just a few complex procs. I’ve always found that whenever we try to make one procedure do multiple things as opposed to one focused thing, it becomes so much harder to debug and test it.

    You say “should stored procs be many or focused?”, I would suggest that this is an incorrect comparison.

    If you have many stored procs, it follows that they will be more focused because they will be smaller and do less. Perhaps you really mean to ask “Many focused stored procs, or fewer broader stored procs?”

    A tool such as db ghost and others should also be used to source control your stored procedure code (and schema) so you treat it just like any other code. With this in place, management of many smaller procedures is even easier.

    This is really just applying the core good design practice of separation of concerns to your “database code” as well as all other code.

    As another answer also says, I’m a fan of using stored procs to “crunch” your data, as close as possible to the database, such as in reporting procs. This is due to performance reasons, ie getting the db to do what it is good at.

    However when it comes to a lot of other type of “business logic”, we generally try to keep this out of stored procs and in normal code where we have much better debugging and testing facilities.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a generic class that should allow any type, primitive or otherwise. The
You should be able to create a generic form: public partial class MyGenericForm<T> :
I have a generic Repository<T> class I want to use with an ObjectDataSource. Repository<T>
Is there a generic way, without creating and managing your own CLR host, to
I've got a generic dictionary Dictionary<string, T> that I would like to essentially make
any generic way to trace/log values of all local variables when an exception occurs
There must be a generic way to transform some hierachical XML such as: <element1
I've got a generic<> function that takes a linq query ('items') and enumerates through
I have a generic class that I'm trying to implement implicit type casting for.
I am creating a generic error handling / logging class for our applications. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.