Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Commenting SQL queries
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00629241
Message ID:
00629580
Vues:
17
>>>Our company is in the process of implementing documentation processes in the programming department. In discussions, it was determined that none of the programmers were aware of a way to place comments in an SQL query in order to document what the SQL code was doing at a glance.
>>>
>>>Can anyone here provide any input?
>>>
>>>Thanks, Mike
>>
>>Not sure, if this is the answer you're looking for, but do you know, what you can:
>>
>>select myField1, myField2, ; && Prepare list of fields
>>      from table1 inner join table2 ; && both tables have integer PK and FK
>>
>>
>>e.g. put your comments inside the select statement?
>>
>>Be careful to not end comment line with ";" otherwise your next line would become a comment too...
>
>IMO, it's realy bad idea to comment query like that. It makes it hard to read and maintain.

I agree in general and rarely use it. Only in cases when I don't need some fields anymore or I modified some portion of query, I put part, which is no longer used in comments.

However, Michael asked a reasonable question: how can we comment our queries? I didn't do it in my code, but it's not always obvious for another programer, what's the purpose of the query and why it's written this particular way...

Can you suggest some good commenting style?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform