SQL Server查找XML里面符合某个条件的数据的用法

2026-02-25 04:41 栏目: 技术学堂 查看( )

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里面复合某个条件的用法就介绍到这里了,希望本次的介绍能够对您有所收获!

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流

郑重申明:某某网络以外的任何单位或个人,不得使用该案例作为工作成功展示!