Erik Porter (gravatar)

Who Loves Naming Conventions? *raises hand*

I've been posting about naming conventions lately and of course have been finding that as usual, most people think I am a big idiot!  It's cool everyone, I already knew that...so there!  :P

But look, it's another thread on the subject and so happens to be on a subject I've been preaching on for a while, dealing with naming Stored Procedures, so I have a lot of respect for Phil posting this one and a damn good reason for doing it other than just a personal preference!

On that note also, who out there prefixes their database Table names out there with something like “tbl”?  Come on now...who out there does it?  I've seen it before and I HATE it!  ;)

11 Comments

  • I must admit I've been guilty of doing the "tbl" prefix a few times myself... it shows my MS Access legacy (used to be an Access MVP)... in there you had to prefix tables with "tbl" and queries with "qry" so you didn't get naming conflicts, as your form (which often had the same name again but with "frm" prefix) would always refer to a query for it's data as it's sorted and aggregated etc. In SQL-Server it's not that big of an issue, as long as you're naming your SPs well. Thanks for another great post HC!

  • Glad you enjoyed it, Tim! Good to see you admitting you did that and thanks for the info on why you did it...very interesting...I almost feel like I'm at an AA meeting or something! :P According to the patterns of my other recent entries though, the next 5 people will be leaving comments that they very much disagree and as always that I'm a big idiot! ;) Ok, nobody ever really says that, but hey, I'm a humble guy! weeeeeeee

  • Pretty much the only naming convention I use is putting View at the end of views. Hard to tell the difference between a view and table in a select statement.

  • True, Phil, but does it matter if it's a Table or a View? ;)

  • Well, I'm not here to tell you you are a big idiot. Actually I really appreciate the posts as they make me question why I do some of the things I do. Thanks.

  • That's awesome right there...go Ron! :)

  • I used to use "t" for tables and "v" for views, but now I only use a prefix on views ("v") and on stored procedures ("st"). I use "st" rather than "sp" on stored procedures because of the problem mentioned by Phil.

  • I would encourage you to use an abbreviation for all of your objects - tables, views, sprocs, etc. - for an appliation. It helps with migration and deployment, esp. if you are building an application that others will use. For example, the .Text blogging software prefixes everything with blog_. The ASP.NET Forums, IIRC, prefix everything with forum_. Good to handle potential naming conflicts for those who import your schema into their own database with existing objects. (For those who are using a Web hosting account, creating a new database for the project is often not an (affordable) option.)

  • That's a really good point. I'm in a hosting environment and do that with my tables, views, etc Man, maybe I'll have to make up another entry just of everybody's recommendations to have in one spot!

  • http:// (gravatar)

    http:// said
    August 08, 2003

    We organize our stored procedures by function and that is reflected in the name. If it is a proc used by an engine, then the prefix is bsp_, if it is for a GUI, then it is usp_ui_ and all others are usp_ . As for Views, we preface those with uv_ .

  • http:// (gravatar)

    http:// said
    August 08, 2003

    *raises hand* Yeah, I prefixes tables with tbl.. that is, physical tables. I hate bracketing tables/fields with [], so therefore I prefix.. I even prefixes fields.. vchName, intOrderID etc. But, what is the problem with this?, I keep this only on the database, uses sp's to access the tables (get/set/delete sp's etc), and then I have an tind data-access layer wich uses typed datasets, and there I use normal fieldnames, tablenames etc, like Order, ID, Name... well..

Your Information
Mrs. Gravatar (gravatar)

<-- It's a gravatar

your comment