SQL Server查找XML里面符合某个条件的数据是如何实现的呢?本文我们就介绍一下这部分内容的实现,我们假设表里面点开一个XML字段的值如下:
<MasterxRow> <ActivityType>2</ActivityType> <ProductType>21</ProductType> <RefNo>222222222222222222222</RefNo> <ContactResult>0</ContactResult> <Reason /> <OtherReason /> <OtherActivityType /> <OtherProductType /> <ReferrerID /> <ReferrerType /> <CampaignCode>889</CampaignCode> <CampaignName>70</CampaignName> <IsNull>false</IsNull> <AcceptReason>合作愉快</AcceptReason> <AcceptReasonText>99</AcceptReasonText> </MasterxRow>
搜索所有符合ProductType=21的数据: select * from tblContactLogs where ProductResponse.exist('//ProductType[.=3]')=1
关于SQL Server查找XML里面复合某个条件的用法就介绍到这里了,希望本次的介绍能够对您有所收获!