久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

SQL Server XML 列上的 Where 子句過濾屬性 AND 值

Where clause on a SQL Server XML column filtering on attribute AND value(SQL Server XML 列上的 Where 子句過濾屬性 AND 值)
本文介紹了SQL Server XML 列上的 Where 子句過濾屬性 AND 值的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我在文檔"表中有一個(gè)元數(shù)據(jù)"字段,其中包含以下數(shù)據(jù):

I have a 'Metadata' field in table 'Document' that has the following data:

<properties>
  <property name="someProp">xyz</property>
  <property name="reportId">55</property>
  <property name="someOtherProp">abc</property>
</properties>'

如何編寫一個(gè)查詢來返回存在名稱為reportId"的屬性元素并且reportId"屬性元素的值為 55 的記錄?有時(shí)reportId"屬性節(jié)點(diǎn)是唯一存在的節(jié)點(diǎn),有時(shí)不存在,并且它并不總是按上述順序排列,因此我無法查詢絕對位置.有什么想法嗎?

How can I write a query that returns records where a property element exists with a name of "reportId" and that "reportId" property element has a value of 55? Sometimes the "reportId" property node is the only one that exists, sometimes not, and it's not always in the above order so I can't query on absolute positions. Any ideas?

推薦答案

不需要提取值.使用 exist() 方法(xml 數(shù)據(jù)類型) 代替.

There is no need to extract the value. Use exist() Method (xml Data Type) instead.

select *
from Document
where Metadata.exist('/properties/property[@name="reportId" and . = 55]') = 1

這篇關(guān)于SQL Server XML 列上的 Where 子句過濾屬性 AND 值的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Converting Every Child Tags in to a Single Column with multiple Delimiters -SQL Server (3)(將每個(gè)子標(biāo)記轉(zhuǎn)換為具有多個(gè)分隔符的單列-SQL Server (3))
How can I create a view from more than one table?(如何從多個(gè)表創(chuàng)建視圖?)
Create calculated value based on calculated value inside previous row(根據(jù)前一行內(nèi)的計(jì)算值創(chuàng)建計(jì)算值)
How do I stack the first two columns of a table into a single column, but also pair third column with the first column only?(如何將表格的前兩列堆疊成一列,但也僅將第三列與第一列配對?) - IT屋-程序員軟件開發(fā)技
Recursive t-sql query(遞歸 t-sql 查詢)
Convert Month Name to Date / Month Number (Combinations of Questions amp; Answers)(將月份名稱轉(zhuǎn)換為日期/月份編號(問題和答案的組合))
主站蜘蛛池模板: 久久a久久 | 毛片av免费在线观看 | 久久99这里只有精品 | 毛片网在线观看 | 精品国产精品一区二区夜夜嗨 | 亚洲一区二区不卡在线观看 | 国产目拍亚洲精品99久久精品 | 草久久 | 一级高清| 成人精品一区 | 一级黄色短片 | 99国产视频| 免费在线观看一区二区 | 欧美视频在线看 | 日韩α片| 野狼在线社区2017入口 | 欧美理伦片在线播放 | 久久久久久中文字幕 | 欧美a视频| 一区二区三区国产视频 | 国产一级在线观看 | 北条麻妃国产九九九精品小说 | 亚洲69p| 四虎在线视频 | 久久狠狠 | 久久偷人| 亚洲成人精品一区 | 欧美日韩在线视频一区 | 亚洲视频自拍 | 午夜一区二区三区视频 | 国产精品亚洲综合 | 国产成人小视频 | 亚洲国产高清在线 | 女女百合av大片一区二区三区九县 | 欧美一区二区三区久久精品 | 波多野结衣一区二区三区在线观看 | 高清一区二区视频 | 性欧美xxxx| 97av视频在线观看 | 日韩一区二区三区在线视频 | 国产一区二区三区免费观看视频 |