My first question on Stack Overflow :)
I have XML:
DECLARE @xml XML = '<root><tag1 /><tag2 /></root>';
I need to remove node, but, path to node is variable "@path".
DECLARE @path XML = '/root/tag2';
My query is:
SET @xml.[modify]('delete sql:variable("@path")');
But, I get error: Msg 9342, Level 16, State 1, Line 9 XQuery [modify()]: An XML instance is only supported as the direct source of an insert using sql:column/sql:variable.
So my question is: how can I delete xml node by sql parameter?
EXEC()...