• Pseudo-code is for procedural programming, and should only be in the design document. Not in the comments. That's not what comments are for, they should clarify.

    My commenting style is to first do a comment that describes the function of the query.

    Then in the query itself I will add inline comments to explain the implementation choices and to help future me understand current me.

    I do not like rules about how much comments to use. If something is obvious, I will not add a comment. If something needs a full novella to explain the logic, I will add a full novella in the comments (allthough I'd probably try to simplify it first).


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/