SQL 解析XML
DECLARE @ReasonList XML='<ReasonList> <Reason><ReasonText>aaa</ReasonText><IfAgree>0</IfAgree></Reason> <Reason><ReasonText>bbb</ReasonText><IfAgree>1</IfAgree></Reason> <Reason><ReasonText>ccc</ReasonText><IfAgree>1</IfAgree></Reason> <Reason><ReasonText>ddd</ReasonText><IfAgree>1</IfAgree></Reason> <Reason><ReasonText>eee</ReasonText><IfAgree>1</IfAgree></Reason> <Reason><ReasonText>fff</ReasonText><IfAgree>1</IfAgree></Reason> <Reason><ReasonText>ggg</ReasonText><IfAgree>1</IfAgree></Reason> <Reason><ReasonText>hhh</ReasonText><IfAgree>0</IfAgree></Reason> <Reason><ReasonText>iii</ReasonText><IfAgree>0</IfAgree></Reason> <Reason><ReasonText>jjj</ReasonText><IfAgree>0</IfAgree></Reason> <Reason><ReasonText>kkk</ReasonText><IfAgree>0</IfAgree></Reason> </ReasonList>' SELECT T.c.value('(./IfAgree)[1]', 'int') FROM @ReasonList.nodes('/ReasonList[1]/Reason') AS T ( c )
http://www.cnblogs.com/Olive116/p/3355840.html