Skip Navigation LinksHome > SSW Standards > Developer SQL Server > SQL Server Standard Indexes Naming

What others have to say about us
See what people think about this product I've been putting together Development Guidelines for my employer and in the process have reviewed many published standards (in the .Net arena) from around the world. In each category, the suggestions at SSW are always among the best. See what people think about this product
- Leon Bambrick,
  SQL Server Indexes Naming Standard

This standard outlines the procedure on naming Indexes at SSW for SQL Server. Use this standard when creating new Indexes or if you find an older Index that doesn't follow that standard.

Note: There is not a lot of use naming Indexes - we only do it when we are printing out documentation or using the 'Index Tuning Wizard' - then it becomes real handy.

Do you agree with them all? Are we missing some? Let us know what you think.

Syntax

Index names are to have this syntax:
[pkc_] [TableName] by [FieldName]
[   1  ] [    2        ]      [    3       ]

[1] All indexes must have a corresponding prefix.

Prefix
Type
pkc_ Primary Key, Clustered
pknc_ Primary Key, Non Clustered
ncu_ Non Clustered, Unique
cu_ Clustered, Unique
nc_ Non Clustered (Most Common)

 

Make unique index name if possible. Ie. ProductName

[2] The name of the table that the Index refers to.

[3] The name of the column(s) that the Index refers to.

Examples


Old Style
Recommended Style
Index 'BillingID' 'nc_ClientDiary_BillingID'
Primary Key 'aaaaaClient_PK' 'pknc_ClientDiary_ClientID'

Acknowledgments

Adam Cogan