当前位置: 代码迷 >> Sql Server >> full text index
  详细解决方案

full text index

热度:219   发布时间:2016-04-27 11:02:01.0
full text index求助
SQL2008R2, SQL Full-text服务已启动.
测试如下,为何结果总是返回0笔呢.
SQL code
create database DBAPuse DBAPcreate table tb5( tsid int not null,  tsde char(8000),  descr varchar(30)  constraint pk_tb5 primary key clustered(tsid))create index idx_tb5_descr on tb5(descr)set nocount ondeclare @x int=1while @x<=100000begin   insert into tb5(tsid,tsde,descr)     values(@x,'313ccx',rtrim(@x)+'cxccx')    select @[email protected]+1endset nocount offif(select databaseproperty('DBAP','isfulltextenabled'))=0    execute sp_fulltext_database 'enable'execute sp_fulltext_catalog 'ft_pubs','create','D:\sqldata\ft'execute sp_fulltext_table 'tb5','create','ft_pubs','pk_tb5'execute sp_fulltext_column 'tb5','descr','add'execute sp_fulltext_table 'tb5','activate'execute sp_fulltext_catalog 'ft_pubs','start_full'while fulltextcatalogproperty('ft_pubs','populateStatus')<>0begin  waitfor delay '00:00:05'end--问题..为何总是返回0呢?select count(1)from tb5where contains(descr,'35')


------解决方案--------------------
contains中判断的字段要在select中出现吧。
试试:
select descr
from tb5
where contains(descr,'35')

------解决方案--------------------
contains用法唐诗看看这个,希望对你有帮助。
  相关解决方案