Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 SQL object naming conventions

Author  Topic 

steppinthrax
Starting Member

27 Posts

Posted - 2010-01-07 : 16:03:20
Hello guys, this question is easily answerable. However, I'm looking for the best answer. Regarding objects within the SQL server (tables, Stored procedures, functions, constains) what are good naming conventions. Or what is the INDUSTRY STANDARD for most companies that are a well respected and tested set of standards. I've heard everything from no underscores, CaMeL case etc....

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-01-07 : 16:12:04
We use the following:

usp_ (application stored procedures)
isp_ (DBA stored procedures)
rsp_ (stored procedures used for reports)
v_ (views)
udf_ (functions)
cidx_ (clustered indexes)
uniq_ (unique indexes)
idx_ (non-unique, non-clustered indexes)
PK_TableName (primary key constraint)
FK_Table1_Table2 (foreign key constraint)
chk_ (check constraints)

We do not prefix table names.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

shan
Yak Posting Veteran

84 Posts

Posted - 2010-01-07 : 16:13:59
You may refer the link below too..


http://vyaskn.tripod.com/object_naming.htm

http://vyaskn.tripod.com/coding_conventions.htm




-Shan
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-01-07 : 21:17:12
quote:
Originally posted by tkizer

We do not prefix table names.

Every time I see a table prefixed "tbl" I want to gag or scream lol. Anyone who can't recognize a table in context needn't access any database I'm responsible for
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-01-07 : 21:53:11
Exactly.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page
   

- Advertisement -