Object naming standards
- Repost - originally posted 06-09-2012
- Oct 20, 2017
- 1 min read
Do you have a standard naming convention?
Most application databases have standard prefixes for tables (tbl_), views (vw_), user stored prcedures (usp_), user defined functions (udf_) etc.
But do you have a standard for Primary Keys, Foreign Keys, constraints and defaults?
By creating a standard you can make debugging and tracing of violations back to the source a lot quicker. An example would be PK_schemaname_tablename for primary keys. FK_foreigntableschemaname_foreigntablename_foreigntablecolumnname.
Defaults are defined as DEF_schemaname_tablename_columnname.
Check constraints use CHK_ instead of DEF_ and unqiue constraints are UQ_ instead of DEF_.
It is a lot easier to find the issue with UQ_Patient_Picture_FileStreamID rather than a system generated UQ__Picture__2957490CF9A66DF5, although there can be an issue with the name becoming too long and unwieldly.
Just have a standard that works for you.

Comments