Ben bir xml değişken @ResultData
SQL Server XML ad alanı Sorgulama Problemi
<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_>
aşağıdaki var Ama çünkü düğümünde xmlns=...
arasında ondan JournalNum değerlerini seçmek için görünmüyor olabilir. .Net'de onu almak için "{http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKey}KeyData"
gibi bir şey yapabilirim, ancak SQL'de bir sözdizimi hatası alıyorum.
Ben sadece bir geçici tabloya belge sırayla değer düğüm listesi, almak istiyorum ve bu da işe yaramaz ....
SELECT IDENTITY(int,1,1) as 'ID',
c.query('(KeyData/KeyField/Value)[1]') as 'JournalNum'
INTO #tmpBatches
FROM @ResultData.nodes('//EntityKey') t(c)
Düşünceler? Öneriler? Çözümler?
Çok teşekkür ederim! Sonunda, xpath sorgularımdaki bu sinir bozucu ad alanlarından kurtuldum. –