首页 > 数据库技术 > 详细

sql操作xml类型的的数据

时间:2019-09-30 15:08:08      阅读:62      评论:0      收藏:0      [点我收藏+]

查询:

select * from ceshitable where ceshi.value(‘(ceshi/name)[1]‘,‘nvarchar(200)‘) like ‘%ceshi9%‘;

技术分享图片

 

修改:

update ceshitable set ceshi.modify(‘replace value of (ceshi/name//text())[1] with "修改后的值"‘) where ceshi.value(‘(ceshi/id)[1]‘,‘int‘) = 1;

 技术分享图片

 

 

排序:

select top 10 * from ceshitable order by ceshi.value(‘(ceshi/id)[1]‘, ‘int‘)

技术分享图片

 

汇总:

select SUM(ceshi.value(‘(ceshi/id)[1]‘,‘int‘)) from ceshitable where ceshi.value(‘(ceshi/id)[1]‘,‘int‘) <=10

 技术分享图片

 

 

分组:

select COUNT(*),table1.tName from (

SELECT table2.Loc.value(‘TitleIntact[1]‘,‘varchar(250)‘) as tName  FROM   PE_ContentManage_Article

CROSS APPLY ExtendContent.nodes(‘/ExtendContent‘) as table2(Loc)) as table1

GROUP by table1.tName

技术分享图片

 

sql操作xml类型的的数据

原文:https://www.cnblogs.com/lightpro/p/11612783.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!