Prev: Alter table
Next: SELECT SUBSTRING
From: Erland Sommarskog on 9 Mar 2010 03:13 Johnny Persson (a(a)a.a) writes: > Yes, below is a real example of one of our parsers. As far as I > understand the node addressing is correct.. Or am I wrong? It has > happened before :) "Correct" and "best" are two different things. > CROSS APPLY TG.T.nodes('C') AS TOS(T) > CROSS APPLY TOS.T.nodes('D') AS TOO(T) Here you should have /C and /D for best performance. If you only specify C, XPath will return any node named C, not just top nodes. And finding those takes more time. -- Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
From: Erland Sommarskog on 9 Mar 2010 03:15 Johnny Persson (a(a)a.a) writes: > I have now tried to shred the data in a C# console project. The > performance gain is huge. > > Which is the best option to pass the data to the SQL server? Bulk load > into a table variable or "send the data" through a table valued CLR > method? SqlBulkCopy or table-valued parameters if you are on SQL 2008. -- Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
From: Johnny Persson on 9 Mar 2010 03:26
Ok, thank you for all your answers. I will parse the xmls inside a C#-project and pass the data through a table-valed parameter. Thank you all, once again. Regards Johnny On 2010-03-09 09:15, Erland Sommarskog wrote: > Johnny Persson (a(a)a.a) writes: >> I have now tried to shred the data in a C# console project. The >> performance gain is huge. >> >> Which is the best option to pass the data to the SQL server? Bulk load >> into a table variable or "send the data" through a table valued CLR >> method? > > > SqlBulkCopy or table-valued parameters if you are on SQL 2008. > > |