What are your naming conventions for SQL Server objects?

Apparently, there are many very varied naming guidelines for sql server objects. I was wondering if there are any formal recommendations besides the prefix of stored procedures with sp_?


As Matt noted, there is already a similar question: Naming conventions in the database, tables, and columns? , so please vote to close this (I don’t know, I don’t understand why I can’t close my question?!?).

+3
source share
4 answers

I use usp for sprocs, udf for functions, vw for views, and triggers for triggers. I do not use anything for tables.

, , , sysobjects .

+2

, , ( empID).

0

, , , :

tr_  for triggers
fn_  for user defined functions

, .

, - . ,

dal_  for CRUD select, insert, delete
ac_  accounting functions
rep_ for reports
se_   security

...

.. .

0

, tblTableName, vwViewName, spStoredProcedure fldFieldName. , , tbl, vw fld.

I really stick with spStoredProcedure, although not sure why, but it's pretty easy to type spSomething.

For tables, I now call them something descriptive and the same for fields. Usually I use lowercase letters for the first word, and then the capital letters of the first letter of the second word.

i.e.: employeeRecords, spGetEmployees, etc.

0
source

Source: https://habr.com/ru/post/1703783/


All Articles