• ON the topic of the NOLOCK issue, the most common reason people use it is because they have poor performance. The database design could be part of that, the code could be part of that, the indexes could be part of that.

    Rather than implement the time to fix some of those performance issues, they use NOLOCK to bandaid the issue. Often times NOLOCK creates an illusion of the infamous "turbo" button. Fixing the code, indexes or DB design could often alleviate those problems.

    A secondary issue seems that your OLTP database is also serving up your reporting/warehouse requirements. This is another common reason why NOLOCK gets implemented. Even in this situation, performance tuning of the code, indexes, database et al would help to alleviate much of the performance issues and thus eliminate most reasons for using NOLOCK.

    As for the CTEs, it is something that should be tested cases by case. Sometimes it makes more sense and provides better performance to use a temp table and sometimes it is better to use a cte.

    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