Do you use a SQL Server object naming standard?
Last updated by Jayden Alchin [SSW] over 2 years ago.See historyThis standard outlines the standard on naming objects within SQL Server. Use these standards when naming any object or fix if you find an older object that doesn't follow these standards.
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 |
Note: 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