1

如何修改此查询以搜索仅相隔两个单词的关键字?

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)'
               );

但得到错误Msg 7630, Level 15, State 2, Line 2 Syntax error near '(' in the full-text search condition 'NEAR ((execute, class , program, SQL ,code),2,true)';

我努力了

select id, SubjectText from dbo.email where contains ([ContentText],'"( (execute near class, near program ,NEAR code,near SQL ))"',2,true); 去

select id, SubjectText from dbo.email where contains ([ContentText],'near( (execute , class, program code, SQL ))',2,true); 去

select id, SubjectText from dbo.email where contains ([ContentText],' (execute near class near program NEAR code near SQL)',2,true); 去

他们都没有工作他们都产生错误请帮助

4

1 回答 1

0

文档所述,只有 SQL Server 2012 允许您指定搜索词之间的最大距离,因此如果您使用的是 SQL Server 2008,则会收到此错误。

于 2013-04-16T19:27:41.813 回答