您的位置:首页 > 其它

如何在sql中查询xml字符串

2010-01-15 17:26 423 查看
今天第一次尝试用xpath去搜索xml字符串,把自己写的sql帖在下面,以后参考

WITH XMLNAMESPACES (
'http://www.gamingstandards.com/s2s/schemas/v1.2.6/' AS s2s,
'http://s2s.igt.com/player-ext1/v1.0.0' as p1)
select cast(body as xml).value('(/s2s:s2sMessage/s2s:s2sBody/s2s:player/s2s:playerInfo/@p1:playerId)[1]','varchar(50)') from dbo.s2sOutBound_Complete
where cast(body as xml).exist('/s2s:s2sMessage/s2s:s2sBody/s2s:player/s2s:playerInfo') =1
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: