• Hey all...

    I don't know how it happened, but the code in the article is missing some spaces from what I submitted. They should be pretty obvious where that is, but if you are having problems let me know and I'll post how it should be (or get Steve or someone to add them to the article).

    The biggest offenders:

    space needed between "use" and "AdventureWorks"

    space needed between "set" / "select" / "declare" / "print" / "if" and the rest of the command.

    space needed between "FOR" and "XML"

    space needed between "XML" and "PATH"

    Wayne

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2