T-SQL Coding Standards

  • Hi , i am trying to build out T-SQL standard for our team , it would be followed for all T-SQL we write SP,Trigger etc , can you please share your best practices documents or standards?

  • sqlquery-101401 (3/29/2010)


    Hi , i am trying to build out T-SQL standard for our team , it would be followed for all T-SQL we write SP,Trigger etc , can you please share your best practices documents or standards?

    Post one of your triggers and shorter SP's... the best way to write a standard is to see what's currently wrong if anything.

    --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)

  • Avoid the use of nolock.

    Document your code.

    Format your code and stay consistent. Code that is easy to read is easier to troubleshoot.

    Explicitly define your joins (could spare you some time due to an accidental cross join)

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply