Given an SQL XML table column with contents like this:
I'm trying to modify it with an SQL query like this:
This SQL causes this error:
Msg 8137, Level 16, State 1, Line 39
Incorrect use of the XML data type method 'modify'. A non-mutator method is expected in this context.
[/color red]
What am I doing wrong?
Code:
<fld>
<state>WA</state>
<taxcert>A18 3865 10</taxcert>
<effective>1/1/2010</effective>
<certexp_yn>Y</certexp_yn>
<expires>12/31/2010</expires>
<singleuse_yn>N</singleuse_yn>
<exempt_yn>N</exempt_yn>
<exempt_reason />
</fld>
Code:
SELECT TOP 100
[XMLData].modify('insert <entityusecode_id />
after (/fld)[1]
')
FROM [SCANREF] AS S
Msg 8137, Level 16, State 1, Line 39
Incorrect use of the XML data type method 'modify'. A non-mutator method is expected in this context.
[/color red]
What am I doing wrong?