Contains()函数与数字串有关吗? [英] Contains() function falters with strings of numbers?

查看:153
本文介绍了Contains()函数与数字串有关吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于一些背景信息,我创建了一个应用程序,用于搜索几个索引表以检索一些记录。对Google来说这并不是非常复杂,但对于它所服务的目的而言,这已经足够了,除了这个奇怪的问题。



我使用 Contains()函数,它非常好,除非搜索包含字符串数字。现在,我只传入一个字符串 - 无法传入数字数据类型 - 只传递字符。我们正在搜索一系列电子邮件,每个电子邮件从工作流程中删除时都附加了自定义ID。所以在测试时,我们决定通过数字字符串进行搜索。



在我们的测试中,我们隔离了一个 0042600006 ,它属于一个且只有一个电子邮件主题。但是,当使用我们的查询时,我们得到的结果为 0042600001 0042600002 等。查询如下(一些常用的列):

SELECT说明,subject FROM tableA WHERE CONTAINS((subject),'0042600006')
$ b

我们尝试了所有可能的组合:'0042600006 *' '0042600006''0042600006 *'

我认为这只是该功能的限制,但我认为这可能是最佳答案。提前致谢。

解决方案

尝试添加语言1033 作为附加参数。 (主题),'0042600006',语言1033)。

  SELECT描述,主题FROM tableA WHERE CONTAINS 


For some background information, I'm creating an application that searches against a couple of indexed tables to retrieve some records. It isn't overtly complex to the point of say Google, but it's good enough for the purpose it serves, barring this strange issue.

I'm using the Contains() function, and it's going very well, except when the search contains strings of numbers. Now, I'm only passing in a string -- nowhere numerical datatypes being passed in -- only characters. We're searching against a collection of emails, each appended with a custom ID when shot off from a workflow. So while testing, we decided to search via number strings.

In our test, we isolated a number 0042600006, which belongs to one and only one email subject. However, when using our query we are getting results for 0042600001, 0042600002, etc. The query is this as follows (with some generic columns standing in):

SELECT description, subject FROM tableA WHERE CONTAINS((subject), '0042600006')

We've tried every possible combination: '0042600006*', '"0042600006"' and '"0042600006*"'.

I think it's just a limitation of the function, but I thought this would probably be the best place for answers. Thanks in advance.

解决方案

try to add language 1033 as an additional parameter. that worked with my solution.

SELECT description, subject FROM tableA WHERE CONTAINS((subject), '0042600006', language 1033)

这篇关于Contains()函数与数字串有关吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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