My Technical Notes

Monday, 11 April 2016

SQL Server Index Naming Conventions

Naming Summary

The Index will be named according to the following rule:


<index-prefix>_<table-name>_<field-names>

Index Prefixes

The following table summarises all the prefixes:

Prefix Type
PKC Primary Key, Clustered
PKNC Primary Key, Non Clustered
NCU Non Clustered, Unique
CU Clustered, Unique
NC Non Clustered (Most Common)

Exceptions to this Convention

The one major exception to this convention is when SQL Server Management Studio automatically names the primary key `PK_<table-name>`. It seems a waste of time changing this each time you create a new table.

References

No comments: