create   table   testIndex 

          id   int   identity(1,1)   primary   key, 
          nm   varchar(100)   unique   not   null, 
          sex   varchar(10) 

create UNIQUE index UQ__testIndex__0DAF0CB0
on testindex(nm)insert   into   testindex   
          select   'Arabica','m'   union   all 
          select   'Atlantica Screen & Profilkläder','w'   union   all 
          select   'MAXI ICA Stornad ','w'   union   all 
          select   'MAXI   ICA ','m' go
--创建全文目录 
sp_fulltext_catalog   'abc','create'     
go
--创建全文索引(‘表名‘,’创建/删除‘,’全文目录名‘,’约束名‘) 
sp_fulltext_table   'testindex','create','abc','UQ__testIndex__0DAF0CB0' 
go
--添加列到全文索引(‘表名‘,’列名‘,’添加/删除‘) 
sp_fulltext_column   'testindex','nm','add' go
--建立全文索引
--activate,是激活表的全文检索能力,也就是在全文目录中注册该表
execute sp_fulltext_table 'testindex','activate'
go
--填充全文索引目录
execute sp_fulltext_catalog 'abc','start_full'
go--检查全文目录填充情况
While fulltextcatalogproperty('abc','populateStatus')<>0
begin--如果全文目录正处于填充状态,则等待30秒后再检测一次
waitfor delay '0:0:30'
end--全文目录填充完成后,即可使用全文目录检索
SELECT   *   FROM   testindex   WHERE   CONTAINS(nm,   'ICA') /*
id          nm                                                                                                   sex        
----------- ---------------------------------------------------------------------------------------------------- ---------- 
3           MAXI ICA Stornad                                                                                 w
4           MAXI   ICA                                                                                           m(所影响的行数为 2 行)*/
go
sp_fulltext_table  'testindex','drop'
go
sp_fulltext_catalog   'abc','drop'  
go  
drop table testIndex