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