Information générale
Forum:
Microsoft SQL Server
Versions des environnements
SQL Server:
SQL Server 2005
>>there are 2 patterns often used: just "ID" for the PK of every table or "ID_Tablename".
>>Variations include PK_Tablename for primary and FK_Tablename for foreign keys.
>>I personally prefer constant "ID_Tablename" as I always use the SQL alias in joins.
>>
>Thank you very much for your input.
on rereading: I have not put enough emphasis on thinking through the options, deciding
but then staying consistent throughout. Not only this cuts down on your code
and mental effort - if you ever have to open part of the data via web tools/fwks
like RoR, Django, Web2Py (and probably some others as well)
you can set such a pattern as basic pattern in all modern fwks/ORMs for all tables by
overwriting the strategy of the fwk at the app level -
setting up your own "convention" instead of [individual table] configuration.
If your app needs different key types (GUID for unattached client side evoked,
IID for server side generated), think about using a generalized hungarian notation,
even if this fell out of favour for variable naming due to static type info -
in pure SQL the old argument still holds true ;-)
regards
thomas
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement