There is a table in the database where there are a lot of records, but I am only interested in ~ 100,000.
Namely, I'm interested in the XML field.
I need to get the name of the node and its value and put in a temporary table.
I make an obvious query:
SELECT aevalue('(local-name(.))[1]','nvarchar(255)') AS NodeName, aevalue('(text())[1]','nvarchar(255)') AS Value INTO #TMP FROM [TABLE] CROSS APPLY XDoc.nodes('root/SomeNode/*') a(e) WHERE EXISTS([Какое-то условие отбора]) So, it runs for a very long time ... Is it possible to somehow somehow get the desired result, or it is impossible to squeeze more speed out of XML?
XML example:
<root> <SomeNode> <f1><f1/> <f3><f3/> <f4><f4/> <f5><f5/> </SomeNode> <SomeNode> <f3><f3/> <f4><f4/> <f5><f5/> </SomeNode> <SomeNode> <f3><f3/> <f5><f5/> </SomeNode> </root>