Object Naming Standards

  • When naming objects in SQL, I've noticed that DBA's seem to use the underscore symbol quite regularly (almost every object has it). I understand that it is explicitly allowed by SQL and that it can help to organize objects for viewing. However, it results in 2 extra keystrokes for every object reference, which is something application programmers HATE (extra typing for no good reason). Can anyone give me a difinitive yes or no on this one and why?

  • Not real reason. People, I think, like it to be easy to read. Wrote something on abbreviations awhile back and someone hammered me on not being able to read the abbreviations, despite the keystrike savings. Personally, I skip the underscores and go with Proper casing.

    Steve Jones

    steve@dkranch.net

  • The rules when the first relational dbs came out was to use the underscore to separate words, making the columns and tables much more meaningful. The other thing that we used to NOT do that Microsoft allows you to do is to use reserved words as column, table names etc. This can be accomplished by using the [xxxx] sytax. I was a dba where the last person who designed the database was a CHEMIST who was a WANNABE programmer. His column names were things like DATE, UNION, SIZE, etc. I will say I am old fashioned but I like underscores, not using reserved words, structing my queries so they are easier to read and comments in my procedures.

    William H. Hoover

    Louisville, Ky

    sweeper_bill@yahoo.com


    William H. Hoover
    Louisville, Ky
    sweeper_bill@yahoo.com

  • In my office we adopted a precomment to views and stored procedures (which still not everyone follows). But it our databases especially those created in the last 8 months by me and some of the other folks you will see.

    /*******************************************

    * Name: ip_InvInput

    * Full Name: Inventory Input

    * Type: Stored Procedure

    * Description: Add item to inventory tables.

    *

    * Created By: James Travis

    * Created On: 6/7/2001

    *

    * Last Modified By: Whoever Here

    * Last Modified On: 8/12/2001

    *

    */

    The in the view or procedure you may see the original piece wrapped and noted by who right by the replacement piece. Also we stick with ip for Procedures. As for underscores I use them mostly to seperate words in shortened version such as PK_tbl_Inventory_PKInvID_IJ_to_tbl_Inv_Equip_FKInvID

    But as for leading, my opinion is never lead with anything other than alphacharacters A-Z or a-z and never start with keywords anywhere (although I adopted this a bit late). And as for programmers, I also program and if they cannot handle the extra characters I have told some then here and gave them a view with columns like C1, C2, C3 and views with names like V1 and state "So which makes more sense to you?". Had only one tell me the shorter version but I told him get over it, it won't happen. Remember office politics will always be there and you will never please anyone, cause once you give them awful names that one asks for, another will complain.

  • I use underscores some, usually in procs for usp_xxxx. Other than that I mostly use CamelCaseMoreOftenThanNot. Definitely skip the reserved words. And no spaces in object names! I believe in readable understand names, both for objects and for variables. The exception is general loop counters where I will just use J or K or whatever.

    Andy

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

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