• I think that what some people consider to be a "code smell" is sometimes actually an indication that the person that wrote the code has a very good handle on the art of writing code for SQL Server.

    For example, there are a lot of people that consider it to be a code smell to use DATEPART abbreviations. If someone consistently uses the 2 character abbreviations (mcs and isowk not withstanding), then I look at it as someone that actually knows what they're doing and hates screen clutter and ragged formatting, as well.

    Another supposed code smell is when people simply subtract one date from another to get a duration. Knowing that writing truly portable code that can actually do much worthwhile is a pipedream at best, I'd much rather see someone do such a subtraction rather than go through all the gyrations that others may go through only to come up with the wrong answer or a formula that has a limited range (millisecond conversions seem to be the favorite, there).

    As a bit of a sidebar, I would have much preferred for Microsoft to have used the much more appropriate and correct "us" abbreviated for microseconds instead of using the code smell of "mcs" and ISO Week should have been abbreviated "IW", which would have followed the 2 character convention used up to that point and made the pronunciation of the abbreviation the very appropriate "ew" sound. 😛

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)