>> I am currently doing a review of my personal database naming conventions
and found that there are not much (good) examples in the
literature for some special objects. <<
Have you looked at the ISO-11179 Standards? I happen to have a book
on this topic, SQL PROGRAMMING STYLE, based on the Standards and few
decades of research in code readability.
>> Certainly there are bigger issues in a database project that that, but
I would like to try cleaning that
up. <<
Actually, formatting and style can reduce the cost of maintaining code
(where 80%+ of the total lifetime cost is) by 8-12%.
>> I am using SQL Server 2005 what requires that constraint names are
unique in the whole database, index names to be unique on table level
at least. I do NOT wish to use any prefixes or suffixes such as PK,
FK, CK, UQ, DF, Trig and so on. <<
Standard SQL requires that constraint names are unique in the schema.
And you got the affix thing right --name something for what it is and
not for how it is used in one place.
>> 1) Triggers .. <verb><object>_<table name>. <<
Very good and ISO conformant.
>> 2) Check constraints: I use <explanation>_<table name> (e. g.
PreventSingleNodes_Relations or ValidateRelationType_Relations) <<
For table level constraints okay; but at the column level you might
want the data element involved
>> 3) Default constraints, Unique constraints .. Better ideas here?
That is because defaults and uniques are really part of the domain of
the attribute rather than a constraint on it
>> 5) Primary key constraints, Foreign key constraints ..<<
I tend not to put a constraint on them at all. Their nature does not
change much so I don't need to reference them. If there is an error,
then the message includes that they are PK or FK, so the constraint
name adds no information.
>> 7) Indexes: As SQL Server does not require unique index names in the
whole database but just in the table, <<
Standard SQL has no physical access methods, since that is considered
implementation and not language definition. I am not sure if other
products have global or local index (hash, bit vector, etc.) names. I
agree that having the table and column names will add information to
the error messages.


|