• You mention spooling, that should not really happen - but I know that it can happen under some circumstances anyway. Some of these issue were addressed in SQL 2008, but you have to turn on trace flag 4199 to get the benefit. I like to believe that this should not be necessary in SQL 2012, but give it a try.

    What you also could consider is to insert the data into a temp table, only taking query('/ns:FormData/ns:legacydata') in that table, and then shred from there.

    These are shots in the dark - it's quite difficult to performance-tune without access to the database.

    [font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]