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

如何在sql這個(gè)例子中的結(jié)果xquery中添加分隔符?

How to do add separator in result xquery in sql this example?(如何在sql這個(gè)例子中的結(jié)果xquery中添加分隔符?)
本文介紹了如何在sql這個(gè)例子中的結(jié)果xquery中添加分隔符?的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

這個(gè)例子中如何在sql中的一個(gè)單元格之間添加分隔符(,)?

How to do add separator (,) between one cell in sql this example?

declare @htmlXML xml = N'<td valign="top" style="border-bottom:1px dashed;"><table width="100%" border="0" cellpadding="2" cellspacing="0"><tr><td valign="bottom"  align="left" style=" font:bold 11px Verdana, Arial, Helvetica, sans-serif;color:#3B4F89; border-bottom:double #3B4F89;">ACER Aspire 1300 Series Laptop Accessory Information:            </td></tr><tr><td class="main"><b>Specification:</b> Brand New ACER Aspire 1360 Series / TravelMate 240, 250 Series laptops CPU fanTested to be 100% working properly. <b>Unit:</b> PCS <b>Type:</b> Laptop CPU Fan<meta itemprop="itemCondition" itemtype="http://schema.org/OfferItemCondition" content="http://schema.org/NewCondition"/><b>Condition:</b> Brand New<b>Warranty:</b> 3 Months<b>Power:</b> DC5V 0.4A<b>Info:</b> Size(mm): 61 x 61 x 12.4, Wire Length: 68mm, (3-wire)3-pin connector</td></tr>            <tr><td class="main"><b>Availability:&amp;nbsp;</b><meta itemprop="availability" content="http://schema.org/InStock"/>In Stock</td></tr><tr><td class="main"><b>Payment | Delivery:&amp;nbsp;</b>PayPal | HongKong Registered Air Mail With Tracking Number, Free&amp;nbsp;&amp;nbsp;<a class="resources-newproduct" href="product_info.php/products_id/3840/vAspire+1300+Series#bottom" title="Jump to detail of payment and shipping">[Detail?]</a></td></tr><tr><td height="30" align="left" valign="middle"><a ><img src="includes/languages/english/images/buttons/button_in_cart.gif" border="0" alt="Add to Cart" title=" Add to Cart " width="93" height="24"/></a>             </td></tr><tr><td><!-- tell_a_friend //--><table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBox"><tr><td><table border="0" width="100%" cellspacing="0" cellpadding="0" class="infoBoxContents"><tr><td><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="1"/></td></tr><tr><td align="left" class="boxText"><form name="tell_a_friend" action="https://www.battery-adapter.com/tell_a_friend.php" method="get"><a class="index_newlink" ><img class="image_float" alt="View &amp; Write Reviews" src="includes/languages/english/images/buttons/button_write_view.gif"  border="0"/></a><a class="index_newlink" ><img class="image_float" alt="Ask a question" src="includes/languages/english/images/buttons/button_ask_question.gif"  border="0"/></a></form></td></tr><tr><td><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="1"/></td></tr></table></td></tr></table>'
    ;


SELECT t.v.value('.','nvarchar(max)') as b
FROM   @htmlXML.nodes('td[2]/table/tr[2]/td') as t(v)

所需的輸出:

Specification: Brand New ACER Aspire 1360 Series / TravelMate 240, 250 Series laptops CPU fan Tested to be 100% working properly. 
 , Unit: PCS 
, Type: Laptop CPU Fan
, Condition: Brand New
, Warranty: 3 Months
, Power: DC5V 0.4A
, Info: Size(mm): 61 x 61 x 12.4, Wire Length: 68mm, (3-wire)3-pin connector

推薦答案

使用 CTE 和變量:

Using a CTE and a variable :

declare @htmlXML xml = N'<td></td><td><table><tr></tr><tr><td class="main"><b>Specification:</b> Some item specification <b>Unit:</b> PCS <b>Type:</b> Laptop CPU Fan<meta itemprop="itemCondition"/><b>Condition:</b> Brand New<b>Warranty:</b> 3 Months<b>Power:</b> DC5V 0.4A<b>Info:</b> Size(mm): 61 x 61 x 12.4, Wire Length: 68mm, (3-wire)3-pin connector</td></tr></table></td>';

declare @Info nvarchar(max);

with CTE AS (
    SELECT 
    row_number() over (order by (select 0)) as rn,
    cast(t.v.query('.') as varchar(max)) as value 
    FROM @htmlXML.nodes('td[2]/table/tr[2]/td//text()') as t(v)
)
select @Info = concat(@Info + char(13) + ', ',t1.value , rtrim(t2.value))
from CTE t1 
join CTE t2 on (t1.rn = t2.rn-1)
where t1.rn%2 > 0;

select @Info;

這篇關(guān)于如何在sql這個(gè)例子中的結(jié)果xquery中添加分隔符?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

Modify Existing decimal places info(修改現(xiàn)有小數(shù)位信息)
The correlation name #39;CONVERT#39; is specified multiple times(多次指定相關(guān)名稱“CONVERT)
T-SQL left join not returning null columns(T-SQL 左連接不返回空列)
remove duplicates from comma or pipeline operator string(從逗號(hào)或管道運(yùn)算符字符串中刪除重復(fù)項(xiàng))
Change an iterative query to a relational set-based query(將迭代查詢更改為基于關(guān)系集的查詢)
concatenate a zero onto sql server select value shows 4 digits still and not 5(將零連接到 sql server 選擇值仍然顯示 4 位而不是 5)
主站蜘蛛池模板: 伊人伊成久久人综合网站 | 精品国产欧美一区二区三区成人 | 欧美激情精品久久久久久免费 | 免费在线成人 | 特黄毛片视频 | 亚洲高清在线观看 | 91中文字幕在线观看 | 青青草一区 | 亚洲欧美日韩在线不卡 | 国产精品爱久久久久久久 | 中文字幕 欧美 日韩 | 免费激情网站 | 精品国产欧美一区二区三区不卡 | 中文字幕av在线播放 | 国产成人精品一区二区三区在线 | 欧美视频二区 | 黄色网址大全在线观看 | 欧美激情久久久 | 日韩手机在线视频 | 国产欧美精品区一区二区三区 | 一级黄a视频 | 国产黄色在线观看 | 日本大片在线播放 | 在线一区视频 | 欧美成年网站 | 亚洲 欧美 日韩 在线 | 不卡一区| 亚洲69p | 亚洲天堂日韩精品 | 日韩欧美视频网站 | 欧美日韩专区 | 九九成人 | 国产精品精品视频 | 日韩在线免费 | 久久久久一区二区三区 | 亚洲风情在线观看 | 亚洲一区二区网站 | 日韩欧美在线一区 | 免费一区二区三区 | 操到爽 | 一级片在线观看视频 |