Click here to Skip to main content
14,696,398 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<updateapproval><request><requestid>54361stdid acw_id="134665156">O427970<role>XYZBC
I have a XML tag like this in one column. I want to capture acw_id="134665156" and store the value "134665156" into acw_id column.

Please help me how to modify the store procedure.
Posted

declare @T table
(
  Records xml
)
declare @c_xml_data varchar(1000)

set @c_xml_data = (select c_xml from bc_xml_errors where n_id=453048)

insert into @T values(@c_xml_data)
select
       V.X.value('@acw_id', 'nvarchar(10)') as c_acw_id
from @T as T
 cross apply T.Records.nodes('updateapproval/request/approver/stdid') as V(X)




where @c_xml is my dynamic xml based on the n_id. also we have to traverse till the desire node in T.Records.nodes
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900