I have a @MyXMLString parameter being passed to a stored procedure in the following format:
DECLARE @MyXMLString XML
SET @MyXMLString =
'<data formID="2">
<UnAssigned AcctTypeID="1"/><UnAssigned AcctTypeID="2"/>
</data>'
In the stored procedure, I have to retrieve the value of formID and AcctTypeID and then update a table.
Now there will be only one formID, which I am able to retrieve
DECLARE @formID int
SET @formID = @MyXMLString.value('(data/@formID)[1]','int')
But there can be one or multiple AcctTypeID, i.e. one or more of '<UnAssigned AcctTypeID="1"/>'. I need help in figuring out how to retrieve it.
