| Business Application Development with: SQL Server, C#, VB, VB.Net, ASP, ASP.Net, and XML |
| N | S |
Novick Software Management • Design • Programming • Training • Consulting |
|
|
News Links Schedule Site Map Contact |
|
|
|
Prefix |
Use |
|
v_ |
For Views. |
|
udf_ |
User-Defined Function |
|
usp_ |
User created stored procedure |
|
dba_ |
User created stored procedure for generic, dba functions. These are independent of the application and are often added to all databases. |
|
dp_ |
User created stored procedure for the data layer of an application. These are usually generated by a program and maintained by the program. |
|
Rpt_ |
Stored procedure that creates the contents of a report. |
|
Test_ |
A stored procedure used to test another stored procedure or a UDF. |
|
d_ |
A Default. Not used often. |
|
rule_ |
A Rule. Not used often. |
I don't usually use a designator for tables. I know that many database designers use "tbl" as a prefix for tables but I've decided that it's unnecessary. The "v" on views is enough to distinguish views from tables. They're to two objects types that are most likely to be confused because they're used in the same places in SQL syntax.
So a name for a stored procedure might be usp_Quote_Sync_Master. Quote is the group. Sync distingishes a subgroup within Quote and Master is the final qualifier.
Capitalization or underscores or both can be used to separate parts of the name for each other. My choice usually depends on local conventions at the client site. When I have my way, I use a mixture depending on the object. Table 2 has a couple of examples of naming a user stored procedure from the Sync function Quote module:
Table 2 Alternative Name Spacing
|
Name |
Style |
|
usp_Quote_Sync_QTDETAIL_Inserts |
Using underscores to separate the parts. |
|
uspQuoteSyncQTDETAILInserts |
Camel case |
|
Usp_Quote_SyncQTDETAIL_Inserts |
Mixed underscores and camel case. Used in this case for readability because QTDETAIL was all caps. |
We're just getting started. In Part II of this article, I'll take a look at putting together the parts of a name and show plenty of examples of how my naming strategy works.
Transact-SQL User-Defined Functions has been published! Take a look at it now!
Do you have an interesting stored procedure, user-defined-function,
or other sample code? If you'd like to share them please send
them in an email to:
coding-in-sql@NovickSoftware.com
and they might be published in this newsletter. I try and
respond to every request that I get.
Thanks,
Andy
Andrew Novick
New Tips:Loading SQL Profiler trace (.trc) files with fn_trace_gettrace |
Upcoming
|
|
Copyright © 2003-2008 Novick Software, Inc. | Terms of Use | Privacy Policy | Nice Things People Say| |