views:

84

answers:

4

Exists any naming guideline for naming columns at Sql Server? I searched at MSDN, but dont found anything, just for .Net

+1  A: 

There are many resources out there, but nothing that I have been able to truly pin down as a SQL Server specific set or anything published by Microsoft.

However, I really like this list.

Also, very important to NOT start out stored procedures with sp_

To be 100% honest though, the first part of my posted link is the most important. It must make sense for your organization, application, and implementation.

Mitchel Sellers
+1  A: 

As always, google is your friend...

Adrian Grigore
If you are downvoting this article, could you please explain why. He was asking for resources stating that he hasn't found any. I provided a link to lots of such resources.
Adrian Grigore
Not me downvoting you, but i just searched much times, and never found a good pattern
Fujiy
I didn't downvote, and you have a point, but JFGI is not regarded a proper answer on StackOverflow.
Wouter van Nifterick
+3  A: 

There are lots of different conventions out there (and I'm sure other answers may make some specific suggestions) but I think that the most important thing is that you be consistent. If you are going to use a prefix for something, use it everywhere. If you are going to have a foreign key to another table, use the same column name everywhere. If you are going to separate words with underscores, do that everywhere.

In other words, if someone looks at a few tables, they should be able to extrapolate out and guess the names of other tables and columns. It will require less mental processing to remember what things are called.

Adam Batkin
+1  A: 

I find the following short list helpful:

  1. Name tables as pluralnouns (or singular, but as a previous response stated, be consistent) for example "Customers", "Orders", "LineItems"
  2. Stored procedures should be named without any prefixes such as "sp_" since SQL Server uses the "sp_" prefix to denote special meaning for system procedures.
  3. Name columns as though as you would name attributes on a class (without using underscores)
  4. Try not to use space characters in naming columns or database entities since you would have to escape all names with "[...]"
  5. Many-to-many tables: for example "CustomerOrders"
Mike J