Sql server 使用具有最大_距离值的“近”时出现语法错误
如何修改此查询以搜索仅相隔两个单词的关键字Sql server 使用具有最大_距离值的“近”时出现语法错误,sql-server,sql-server-2008,tsql,full-text-indexing,Sql Server,Sql Server 2008,Tsql,Full Text Indexing,如何修改此查询以搜索仅相隔两个单词的关键字 select id, SubjectText from dbo.email where contains ([ContentText],'execute NEAR class near program near code near SQL'); 去 以下是我得到的结果: id SubjectText 1 examples for you 3 Oracle classes starting soon 4 Toms Hardware
select id, SubjectText from dbo.email where contains
([ContentText],'execute NEAR class near program near code near SQL');
去
以下是我得到的结果:
id SubjectText
1 examples for you
3 Oracle classes starting soon
4 Toms Hardware nes letter
5 Registration starts soon
7 Dreamspark SQL order ready
8 SQL classes free online
10 Visual Basic key
20 SQL Help
21 A Free SQL Server Monitoring Package
22 A Monitoring Package
尝试:-
select id, SubjectText
from dbo.email
where contains (ContentText,
'NEAR ((execute, class , program, SQL ,code),2,true)'
);
但在全文搜索条件“near execute,class,program,SQL,code,2,true”中,获取错误消息7630,级别15,状态2,第2行语法错误near
我试过了
从dbo.email中选择id,SubjectText,其中包含
[ContentText],'execute near class,near program,near code,near SQL',2,true;
去
及
从dbo.email中选择id,SubjectText,其中包含
[ContentText],'near execute,class,程序代码,SQL',2,true;
去
及
从dbo.email中选择id,SubjectText,其中包含
[ContentText],“在SQL附近的代码附近的类附近执行程序”,2,true;
去
它们都不起作用它们都会产生错误请帮助正如上面所说,只有SQL Server 2012允许您指定搜索词之间的最大距离,因此如果您使用的是SQL Server 2008,则会出现此错误。您有什么版本的SQL Server?正如上面所说,只有SQL Server 2012允许您指定搜索词之间的最大距离。我使用的是2008,我升级了,我的查询可以正常工作。谢谢你的帮助。很高兴我能帮上忙,我修改了你的标题并添加了我的评论作为答案,这可能会让其他人更容易找到这个