I have have the following xml fragment in a column in SQL Server
<ul>
<li><a id="cat" href="cat.html">Cat</a></li>
<li><a id="dog" href="dog.html">Dog</a></li>
I want to delete the <li>
tag that has an <a>
tag with id="cat"
DECLARE @id varchar(40) = 'cat'
UPDATE dbo.Pref
SET xmlPref.modify('delete /ul/li/a[@id=sql:variable("@id")]')
WHERE pref = 1
Does not quite work as it leaves <li>
around.