0

С помощью Xquery в sql server из xml нужно удалить все узлы, имя которых содержит "key". Как я могу это сделать?

<xml>
    <Node_key_node>
        Text
    </Node_key_node>
    <Node_node>
        Text
    </Node_node>
    <Node_key_node>
        Text
    </Node_key_node>
</xml>

Должно остаться:

<xml>
    <Node_node>
        Text
    </Node_node>
</xml>

1 ответ 1

0
update #t
set col.modify('
    delete //*[contains(local-name(.), "key")]
')

Где #t - имя таблицы, col - имя xml-колонки.

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.