Naming Convention in SQL
Stored Procedure.
sp<Application Name>_[<group name >_]<action type><table name or logical instance> Where action is: Get, Delete, Update, Write, Archive, Insert… i.e. verb
Example: spApplicationName_GetUserDetails
spApplicationName_UpdateEmails
Note :Do not prefix stored procedure names with “SP_”, as “SP_” is reserved for system stored procedures.
Triggers:
TR_<TableName>_<action><description>
Example: TR_Emails_LogEmailChanges , TR_UserDetails_UpdateUserName
Indexes :
IX_<tablename>_<columns separated by_>
Example: IX_UserDetails_UserID
Primary Key :
PK_<tablename>
Example: PK_UserDetails
PK_ Emails
Foreign Key : FK_<tablename_1>_<tablename_2>
Example: FK_UserDetails_Emails
Default:
DF_<table name>_<column name>
Example: DF_ UserDetails _UserName
Tables, Views, Stored Procedures.
- use pascal notation eg: UserDetails
- should end with 's' eg: Emails
If you have big subset of table group than it makes sense to give prefix for this table group. Prefix should be separated by _. eg: edr_Doc
Comments
Post a Comment