• Paul DB (8/20/2008)


    anil_mootha (8/20/2008)


    Hi,

    Why would you prefer to build XML strings manually when you can do it with FOR XML statement.

    The very purpose of FOR XML statement would be void otherwise.

    Thanks and regards

    Anil

    I'm also interested in knowing the answer to Anil's question. Have a great day. 😎

    Pure and simple laziness. In the article, I mentioned I was troubleshooting a performance issue. I was checking to see if the problem was in the processing of the xml string (not the creating of it). I just wanted something quick and dirty to build a string so that I could test it. (Turned out to not be so quick... ) I don't use the FOR XML clause that frequently, so when I do I usually need to check it's syntax to get it right.

    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