Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Join Date
    Jan 2008
    Posts
    186

    Unanswered: What do you prefix your stored procedures with?

    I've seen the following
    Code:
    sp_myProc
    
    usp_myProc
    
    spMyProc
    
    uspMyProc
    
    pMyProc
    What do you guys use? Or is there any informal standard on this?

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Do NOT us sp_ as this is reserved for system stored procedures.

    In this crazy world on database development, consistency is the key.
    George
    Home | Blog

  3. #3
    Join Date
    Jan 2008
    Posts
    186
    Yeah I almost figured that too. Unfortunately, that's the one I like the best~!

    So which do most people use?

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    No prefix

  5. #5
    Join Date
    Jan 2008
    Posts
    186
    Hmmm... never thought of that. I suppose that makes sense b/c in our C#/Java/etc. applications we never typically prefix anything either

    I'm not sure where I got the idea that I had to prefix... Maybe just from sample code which typically have a habit of over-embellishing the standards/commenting part of coding.

  6. #6
    Join Date
    Sep 2005
    Posts
    161
    I preface them with a project name, such as payroll_GiveRaise. There is no need to give them a prefix to tell you it's a stored procedure.

  7. #7
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Ah yes - I'm not saying no naming convention. But a prefix that is on 100% of the objects of one type is not informative.

    Usually I do something like:
    module_entity_action

    Module is like your project. Entity maps to table. Action will be things like deletify, modificationalise, and get

  8. #8
    Join Date
    Jan 2008
    Posts
    186
    Hmm, I see.

    You do raise a good point about how prefixing 100% of your sprocs with the same prefix isn't informative at all.

    I can't limit by project name either, because all these sprocs belong to the same project

    Ack, maybe no prefix is the way to go for me

  9. #9
    Join Date
    Sep 2005
    Posts
    161
    Then use pootle flump's module_entity_action without the module. But keep in mind that many small projects evolve into larger multi-project entities.

  10. #10
    Join Date
    Jan 2008
    Posts
    186
    Yeah, good call there actually.
    Code:
    authors_add
    books_add
    books_expire
    books_isExpired
    etc.
    Sounds good.

    Thanks guys

  11. #11
    Join Date
    Jul 2007
    Posts
    50
    I'm currently using

    <db>_<project>_<table>_<Descriptive text>

    Not for any particular reason tbh.... does make for some long names though.

  12. #12
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Personally, if I have multiple projects using one database then I use schemas to separate them too, meaning that the qualified name for my objects become easier

    E.g. playdb.hr_project.latest_career
    George
    Home | Blog

  13. #13
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    No prefixes on sprocs.
    No prefixes on tables.
    No prefixes on views.
    No prefixes on functions.
    No prefixes on database names.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  14. #14
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    I name all of my stored procedures:
    This_is_not_a_table_view_function_or_database_it_i s_a_sproc_called_procname just in the hope that Blindman has to work on one of my databases ;-)

  15. #15
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I use different naming conventions for different clients. Each has their own preference.

    I worked in one shop for a long time (over 20 years) that had a preference that bordered on religioius dogma for a leading character and camel-case naming, so that habit tends to be ingrained, but I can and do switch from one convention to another as needed for each client.

    -PatP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •