--前提如果sqlserver 2005 express 需要下载 SQLEXPR_ADV.EXE。安装Full-Text支持
--安装完了,FullText Search在Sqserver configuration Manager中的三个服务
中的Sql Server FullText Search中的账户 Log on as "Local System"
在查询分析器中
安下面步骤
--打开数据库
user donab
--打开全文索引支持,启动SQL Server的全文搜索服务
execute sp_fulltext_database 'enable'--建立全文检索目录donba_fulltext
execute sp_fulltext_catalog 'donba_fulltext', 'create','F:"donbafulltext'
为Title列建立全文索引数据元,ProductID为Product表中由主键所建立的唯一索引,这个参数是必需的。
execute sp_fulltext_table 'Product','Create','donba_fulltext','ProductID'
--设置全文索引列名
execute sp_fulltext_column 'Product', 'Name', 'add'
execute sp_fulltext_column 'Product','Summary', 'add'
execute sp_fulltext_column 'Product','Description', 'add'
--建立全文索引
execute sp_fulltext_table 'Product', 'activate'
--填充全文索引目录
execute sp_fulltext_catalog 'donba_fulltext', 'start_full'
--至此,全文索引建立完毕。
--查询
select [productid],[Name],[Description] from Product where contains(Name,'"IBM" and "thinkpad" and "A21"')
--select c1 from ftstable where contains(*,'"apples" and "oranges"')