Naming Conventions for SQL Server

  • I went through  lot of articles for the Standard Naming Conventions for SQL Sever. I still want to know more on this subject from Microsoft.

    Can any one help me find a good article?

    I have visited these sites. So please send me something different.

    http://vyaskn.tripod.com/object_naming.htm

    http://www.sql-server-performance.com/vk_sql_best_practices.asp

    http://www.sqlteam.com/Item.asp?ItemID=4065

  • OK, well, for me, I'm partial to calling SQL Server, "SQL Server".  Sometimes during conversations, I'll simply say "Server" or "The Server".  Then, when lapsing into laziness, I might generically say, "the database" or "the database server"... as for the box itself, I'd probably go with "HAL".

    Sorry, I couldn't resist.

    So what are you afraid of?  Do you not have a set of meta-standards?  That is, a set of standards for standards, which would make even defining a new naming convention ultimately simple, quick, and easily defendable? 

    There are almost as many useless, counterintuitive, and ultimately stupid naming conventions as there are DBAs.

    So what are you really looking for, someone else to blame?  Or the promise that others will not think you a fool if you just name your tables with a "t_" prefix, mixed case, and hungarian notation... 

    Perhaps you just want to be able to justify it to your coworkers or management, like, "Well, this is what Microsoft does so it must be right..."  (Ever read the GUI guidelines/standards that they wrote and then looked at their different applications?)

    So, what are you really looking for?

    I've never seen anybody define meta-standards and apply it to their standard in any article or piece about any programming.  (Other than my own of course).

     

  • Well thanks for the reply.

    I wanted to say I'm really aware of the standards, but I was looking for any interesting article other then I mentioned above. Thats it.

    I dont have to show or prove it to anybody. It is just for upgrading my knowledge, since we have been talking at my work recently.

     

  • So why not start by defining your own set of meta-standards?  You don't have to know anything about SQL Server to do that, you just have to figure out why a standard is necessary, what (generically) makes a standard useful and what makes it counter productive or stupid...  A simple checklist of attributes that can easily be used to evaluate any standard. 

    Chances are, once you do that, you won't need to look and see what others are doing, and the best thing is, you can use it for anything.

  • A few things to remember about standards ...

    • There are always exceptions - plan for and document them
    • They are 'living' documents - the only 'constant' in life is 'change'
    • They are useless with out 'process'
    • They are useless without review and enforcement
    • They will never be adopted without management buy-in and sponsorship

     

     

     

     

    RegardsRudy KomacsarSenior Database Administrator"Ave Caesar! - Morituri te salutamus."

  • One thing that any naming standard needs to consider is the concept of namespace, which define which database objects are within the same uniqueness constraint.

    Columns have a namespace where column names must be unique within a table but do not need to be unique within a schema ie. the same column name can be used in more than one table. Historically, the customary SQL Server schema used is named "dbo".

    Tables and views share the same namespace as you cannot have a table and a view of the same name within the same schema. This makes sense because if you have "select * from dbo.Foo" and there is both a table and a view with that name, which one should be queried ?

    If you are writting standards that might be used by other SQL DBMSs, you also need be aware of their namespaces conventions.

    In SQL Server: these type of objects are in the same namespace:

    CHECK constraint

    Default or DEFAULT constraint

    FOREIGN KEY constraint

    Scalar function

    Inlined table-function

    Stored procedure

    PRIMARY KEY constraint (type is K)

    Replication filter stored procedure

    System table

    Table function

    Trigger

    User table

    UNIQUE constraint (type is K)

    View

    Extended stored procedure

    Notice that index names are not in this object namespace and under SQL Server, index names need only be unique within a table.

    Under Oracle, index names are in the same namespace as tables, view and many other types of objects. Therefore, under Oracle, index names must be unique within the schema.

    Cheers

    SQL = Scarcely Qualifies as a Language

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

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