如何使用LIKE在xml标记之间查找一些信息 [英] How to find some info between xml tags using LIKE

查看:73
本文介绍了如何使用LIKE在xml标记之间查找一些信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我现在遇到问题,我不知道是否有可能用SQL进行操作,

我有一个包含联系人的表,为简单起见,示例中有2列ID和XMLdata,而XMLdata列中有xml数据,例如:< some long =""sutff ="> ..... name> ; john< last name ="> doesomething more> ...

如何搜索XMLdata列的名称或姓氏?

因为我无法使用SELECT * FROM Contacts WHERE XMLdata LIKE``< name>%john%''之类的东西,所以我需要像这样的东西

这有可能吗?

谢谢

Hello i am having a problem right now, i don''t know if it is even possible to do in SQL,

i have a table that contains contacts this table for simplicity of example has 2 columns ID and XMLdata in the XMLdata column there is xml data for example: "<some long="" sutff="">.....name>john<last name="">doesomething more>...

how can i search for name or last name of the column for XMLdata?

cause i can''t use something like SELECT * FROM Contacts WHERE XMLdata LIKE ''<name>%john%'', and i need somethjing like that

is this possible to do?

Thanks

推荐答案

我从此stackoverflow了解到的内容答案 [ ^ ]),则可以将字段强制转换为^ ],然后使用值方法 [
What I understand from this stackoverflow question[^] (see the last answer[^]), you can cast your field to a XML data type[^] and use the value method[^] to retrieve the name.


我认为您需要阅读XML并阅读特定内容节点和进程.

我将尝试在其中找到更多信息.

谢谢
I think you need to read XML and read particular node and process.

I will try to find more in to this.

Thanks


看看下面的链接.

Microsoft SQL Server 2005中的XML支持
Have a look at below link.

XML Support in Microsoft SQL Server 2005


这篇关于如何使用LIKE在xml标记之间查找一些信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆