naming-conventions-sql-server
These are the Naming Conventions I am usually using for SQL Server databases. I think it's a good idea to write them down somewhere... for copy and pasting into documentations. It's a good starting point I think.
Object | Notation | Length | Plural | Prefix | Suffix | Example |
---|---|---|---|---|---|---|
Database | PascalCase | 30 | No | No | No |
MyDatabase
|
Schema | PascalCase | 30 | No | No | No |
MySchema
|
Global Temporary Table | PascalCase | 117 | No | No | No |
##MyTable
|
Local Temporary Table | PascalCase | 116 | No | No | No |
#MyTable
|
File Table | PascalCase | 128 | No |
FT_
|
No |
FT_MyTable
|
Temporal Table | PascalCase | 128 | No | No |
History
|
MyTableHistory
|
Table Column | PascalCase | 128 | No | No | No |
MyColumn
|
Columns Check Constraint | PascalCase | 128 | No |
CTK_
|
No |
CTK_MyTable_MyColumn_AnotherColumn
|
Column Check Constraint | PascalCase | 128 | No |
CK_
|
No |
CK_MyTable_MyColumn
|
Column Default Values | PascalCase | 128 | No |
DF_
|
No |
DF_MyTable_MyColumn
|
Table Primary Key | PascalCase | 128 | No |
PK_
|
No |
PK_MyTable
|
Table Unique (Alternative) Key | PascalCase | 128 | No |
AK_
|
No |
AK_MyTable_MyColumn_AnotherColumn
|
Table Foreign Key | PascalCase | 128 | No |
FK_
|
No |
FK_MyTable_MyColumn_ReferencedTable_ReferencedColumn
|
Table Clustered Index | PascalCase | 128 | No |
IXC_
|
No |
IXC_MyTable_MyColumn_AnotherColumn
|
Table Non Clustered Index | PascalCase | 128 | No |
IX_
|
No |
IX_MyTable_MyColumn_AnotherColumn
|
Table Unique Index | PascalCase | 128 | No |
UX_
|
No |
UX_MyTable_MyColumn_AnotherColumn
|
DDL Trigger | PascalCase | 128 | No |
TR_
|
_DDL
|
TR_LogicalName_DDL
|
DML Trigger | PascalCase | 128 | No |
TR_
|
_DML
|
TR_MyTable_LogicalName_DML
|
Logon Trigger | PascalCase | 128 | No |
TR_
|
_LOG
|
TR_LogicalName_LOG
|
View | PascalCase | 128 | No |
VI_
|
No |
VI_LogicalName
|
Indexed View | PascalCase | 128 | No |
VIX_
|
No |
VIX_LogicalName
|
Statistic | PascalCase | 128 | No |
ST_
|
No |
ST_MyTable_MyColumn_AnotherColumn
|
Stored Procedure | PascalCase | 128 | No |
usp_
|
No |
usp_LogicalName
|
Scalar User-Defined Function | PascalCase | 128 | No |
udf_
|
No |
udf_FunctionLogicalName
|
Table-Valued Function | PascalCase | 128 | No |
tvf_
|
No |
tvf_FunctionLogicalName
|
Sequence | PascalCase | 128 | No |
sq_
|
No |
sq_TableName
|