Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Server naming conventions
Message
De
14/07/2005 10:16:04
 
 
À
14/07/2005 10:00:13
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Versions des environnements
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01031553
Message ID:
01032628
Vues:
15
In regard to naming conventions for Stored Procs, we use two kinds of SPs that we call basic and custom. Every table has three basic SP's ... one for selecting, one for deleting and one for updating ... all by PK (the update one does either an update or an insert, depending on the PK passed to it). We name them like this:

bsp_MyTableGet
bsp_MyTableDelete
bsp_MyTablePut

(It may seem like a lot of work to have 3 SPs for every table, but they are all auto-generated with the click of a button with a VFP utility I wrote.)

All the custom SP names start like this:

csp_MyParentTable

... and then describing what it does ... for example csp_MyParentTableGetAddress

The reason for using the MyParentTable name is that so all the csp's will all be grouped together. For example, the personnel functionality involves a lot more tables than just the Personnel table, but all the csp names will start with csp_Personnel...

~~Bonnie





>>My conventions are:
>>
>>Fields:
>>No spaces on field names, EVER!
>>The PK of a table is always named ID (or the same for all tables), and when using it as a FK the convention is (tablename)ID (I write a lot of dynamic SQL and DMO, this makes things easier) - it also forces you to write readable SQL by using the (table).(field name) convention
>>
>>Tables:
>>Use the tbl Prefix (tblCustomers) - very optional
>>
>>
>>SP:
>>Never preffix with sp_ (forces an extra trip thru the Master DB before resolving in current DB)
>
>Now that's one for the standards book!
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform