I have the following in xml variable @ResultData
<EntityKey_x005B__x005D_> <EntityKey> <KeyData xmlns="http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKey"> <KeyField> <Field>JournalNum</Field> <Value>LJRN000071</Value> </KeyField> </KeyData> </EntityKey> <EntityKey> <KeyData xmlns="http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKey"> <KeyField> <Field>JournalNum</Field> <Value>LJRN000072</Value> </KeyField> </KeyData> </EntityKey> <EntityKey> <KeyData xmlns="http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKey"> <KeyField> <Field>JournalNum</Field> <Value>LJRN000073</Value> </KeyField> </KeyData> </EntityKey> <EntityKey> <KeyData xmlns="http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKey"> <KeyField> <Field>JournalNum</Field> <Value>LJRN000074</Value> </KeyField> </KeyData> </EntityKey> </EntityKey_x005B__x005D_>
But I cannot select JournalNum values ββfrom it due to xmlns=... on node. In .Net, I can do something like "{http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKey}KeyData" to get it, but I get a syntax error in SQL.
I just want to get a list of Value nodes in the order of the document in the temp table, and this will not work.
SELECT IDENTITY(int,1,1) as 'ID', c.query('(KeyData/KeyField/Value)[1]') as 'JournalNum' INTO
Thoughts? Suggestions? Solutions?
xml namespaces sql-server-2008 xpath
Caffgeck
source share