Update a SQL table’s XML value to remove nodes

CodeMinder: to remind myself of stuff that I usually have to look up each time I do it.

To delete all PersonAlternativeName nodes from XmlColumn of the People table:

with xmlnamespaces(
    'http://mydomain.com/person/extension/0.1' as px)
update People
    set XmlColumn.modify('delete //px:PersonAlternateName')

This entry was posted in CodeMinder, Programming, SQL, XML. Bookmark the permalink.