Skip to content

What is your naming convention?

Naming Convention

I am looking for feedback on your naming conventions for a couple areas relating to naming convention. As Stedman Solutions consultants we work for several clients in each week, and sometimes any team member may work with more than 15 clients in a month. That gives us a large variety of exposure to different nomenclatures. Some of those conventions are very different and unique. There are some that I like and some that I don’t like.

If you ever want a tour of an extremely difficult to understand database, take a look at the Great Plains or Microsoft Dynamics database schema and naming conventions. If there is ever a perfect example of what not to do, that is it.

There are a bunch of questions below, what I am really interested in is the why behind each answer?


What is your naming convention for naming tables?

  • Do you always prefix your tables with something like tbl_? 
  • Is there a company standard for now you should name tables? 
  • Do you always use lower case, always upper case, or camel case, or something else?
  • What is your standard for naming tables?

What is your naming convention for naming indexes?

  • Do you like a prefix IDX_ for all indexes, or do you use NC_ or CL_ for nonclustered and clustered, or something completely different?
  • Do you also include the table name or do you not use a table name in the index name?
  • Do you add column names when you create indexes, or do you use some other description?
  • How about included columns, do you add those in the name of the index?
  • If you have an index that contains column names, do you rename it if you add more columns later?
  • When you see the index name is it descriptive enough to know what it does? Do you always trust what it is named?
  • How important is the name of the index really?
  • What is your standard for naming indexes?

What is your naming convention for naming stored procedures?

  • Do you use sp_ as a prefix on your stored procedure names? Are you aware that is generally used for system stored procedures, and is processed differently than other naming conventions?
  • Do you prefix all procedures with anything like proc_ or sproc_? If so, why?
  • Do you prefix your procedures with a verb, like get, set, put, update, insert, etc?
  • When you are scrolling through the list of indexes in SSMS is it quick to find what you need, or do you carpel tunnel from the scroll wheel on your mouse with all the scrolling?
  • What is your standard for naming procedures?

What is your naming convention for naming functions?

  • Do you name table valued functions different that scalar functions?
  • What is your standard for naming functions?

What is your naming convention for naming views?

  • Do you have a prefix for naming views, and if so why?
  • Do all of your views follow a standard or do you have different standards that have been followed over time.
  • Are you views easy and quick to find using SSMS or other tools?
  • What is your standard for naming views?

General

  • Are there any naming conventions that you really like?
  • Are there any naming conventions that you just cannot stand?
  • If you were starting from scratch at a new company on a new project in a brand new database, would you use the same naming conventions that you use today?

Well that’s a lot of questions, and the intention is to start discussion, or at least start you thinking about what the standards are, and why you use them?

Let me know, I am interested in the responses. Leave your comments below.

 

More from Stedman Solutions:

SteveStedman5
Steve and the team at Stedman Solutions are here for all your SQL Server needs.
Contact us today for your free 30 minute consultation..
We are ready to help!

Leave a Reply

Your email address will not be published. Required fields are marked *