Secret ingredients to quality software


General - Do you use a SQL Server Object Naming Standard?

Last updated by Brady Stroud [SSW] on 20 May 2021 04:53 am (about 1 month ago) See History

This standard outlines the standard on naming objects within SQL Server. Use these standards when naming any object or if you find an older object that doesn't follow these standards within SSW.

All feedback is welcome. Thanks to all who gave feedback. A special thanks to Andy Baron.

Object Prefix Example
Table Clients
Column (PK) Id
Column (FK) ClientId
Temporary Table _zt _ztClients
System Table _zs _zsDataVersion, _zsVersionLatest
View vw, gy_ vwClientsWithNoPhoneW, gy_ClientsWithNoPhoneW
Stored Procedure proc, gp_ procSelectClientsClientID, gp_SelectClientsClientID
Trigger trg trgOrderIU
Default* dft * dftToday *
Rule rul rulCheckZIP
User-Defined Datatype udt udtPhone
User-Defined Functions udf udfDueDates

* We never use defaults as objects, this is really an old thing that is just there for backwards compatibility. Much better to use a default constraint.

Other Links

SQL Server Coding Standards - Part 1 By Steve Jones on SQL Server Central

Adam CoganAdam Cogan

We open source. This page is on GitHub