• rohit11.jagannath (4/24/2013)


    2) Removal of unused variables

    Code cleanup, not much to do with optimisation

    4) Replacement of multiple 'Set' statements with a single select statement.

    That's more a style decision than anything else in most cases.

    5) Removing unnecessary BEGIN or END

    Code cleanup, not much to do with optimisation

    7) Replacing 'Else If' conditional blocks with 'Case' statement blocks

    SQL doesn't have a CASE that can replace if/else blocks. SQL's case is a part of a select/insert/update/delete statement

    Take a read through this, yes, it's SQL 2008, most of the principals apply.

    http://www.amazon.com/Server-Performance-Tuning-Distilled-Experts/dp/1430219025

    Optimisation is about making queries run faster, through code changes or indexes.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass