下面的演示在两个演讲中都用到了。因为不能把所用文本数据直接给出,我提供了链接。希望能为大家学习和了解SQL2008 fulltext有帮助。
--------------------------------------------------
-- Create fulltext demo database
--------------------------------------------------
use master
go
DROP DATABASE ftDemoDatabase
go
CREATE DATABASE ftDemoDatabase
go
use ftDemoDatabase
go
--------------------------------------------------
-- Create fulltext catalog
--------------------------------------------------
CREATE FULLTEXT CATALOG ftDemoCatalog AS DEFAULT;
go
--------------------------------------------------
-- Create tables
--------------------------------------------------
CREATE TABLE tblDemoBook (
id int primary key,
title nvarchar(100),
author nvarchar(100),
comment nvarchar(max)
)
go
CREATE TABLE tblDemoContent (
id int identity,
bookid int foreign key references tblDemoBook(id),
chapter int,
content nvarchar(max),
fileName varchar(200),
constraint pk_tbl_DemoContent primary key (id)
)
go
-------------------------------------------------------------------------
-- Insert data into tables
-- You can find the books used in this demo from following links.
-- You need to change file paths below to match yours
-- 雪白血红: http://www.yifan.net/novels/wars/xuehong/xuehong.html
-- 两晋演义: http://www.yifan.net/novels/history/liangjin/liangjin.html
-------------------------------------------------------------------------
INSERT tblDemoBook values
(2, N'雪白血红', N'张正隆', N'报告文学:-1948内战中的东北战场'), (2, N'两晋演义', N'蔡东藩', N'历史小说')
go
INSERT tblDemoContent(bookid, chapter, content, fileName) values
(1, 1,(select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong01.html', SINGLE_CLOB) as T(c)), 'xuehong01.html'),
(1, 2, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong02.html', SINGLE_CLOB) as T(c)), 'xuehong02.html'),
(1, 3, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong03.html', SINGLE_CLOB) as T(c)), 'xuehong03.html'),
(1, 4, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong04.html', SINGLE_CLOB) as T(c)), 'xuehong04.html'),
(1, 5, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong05.html', SINGLE_CLOB) as T(c)), 'xuehong05.html'),
(1, 6, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong06.html', SINGLE_CLOB) as T(c)), 'xuehong06.html'),
(1, 7, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong07.html', SINGLE_CLOB) as T(c)), 'xuehong07.html'),
(1, 8, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong08.html', SINGLE_CLOB) as T(c)), 'xuehong08.html'),
(1, 9, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong09.html', SINGLE_CLOB) as T(c)), 'xuehong09.html'),
(1, 10, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong10.html', SINGLE_CLOB) as T(c)), 'xuehong10.html'),
(1, 11, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong11.html', SINGLE_CLOB) as T(c)), 'xuehong11.html'),
(1, 12, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong12.html', SINGLE_CLOB) as T(c)), 'xuehong12.html'),
(1, 13, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong13.html', SINGLE_CLOB) as T(c)), 'xuehong13.html'),
(1, 14, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong14.html', SINGLE_CLOB) as T(c)), 'xuehong14.html'),
(1, 15, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong15.html', SINGLE_CLOB) as T(c)), 'xuehong15.html'),
(1, 16, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong16.html', SINGLE_CLOB) as T(c)), 'xuehong16.html'),
(1, 17, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong17.html', SINGLE_CLOB) as T(c)), 'xuehong17.html'),
(1, 18, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong18.html', SINGLE_CLOB) as T(c)), 'xuehong18.html'),
(1, 19, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong19.html', SINGLE_CLOB) as T(c)), 'xuehong19.html'),
(1, 20, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong20.html', SINGLE_CLOB) as T(c)), 'xuehong20.html'),
(1, 22, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong21.html', SINGLE_CLOB) as T(c)), 'xuehong21.html'),
(1, 22, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong22.html', SINGLE_CLOB) as T(c)), 'xuehong22.html'),
(1, 23, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong23.html', SINGLE_CLOB) as T(c)), 'xuehong23.html'),
(1, 24, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong24.html', SINGLE_CLOB) as T(c)), 'xuehong24.html'),
(1, 25, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong25.html', SINGLE_CLOB) as T(c)), 'xuehong25.html'),
(1, 26, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong26.html', SINGLE_CLOB) as T(c)), 'xuehong26.html'),
(1, 27, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong27.html', SINGLE_CLOB) as T(c)), 'xuehong27.html'),
(1, 28, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong28.html', SINGLE_CLOB) as T(c)), 'xuehong28.html'),
(1, 29, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong29.html', SINGLE_CLOB) as T(c)), 'xuehong29.html'),
(1, 30, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong30.html', SINGLE_CLOB) as T(c)), 'xuehong30.html'),
(1, 32, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong31.html', SINGLE_CLOB) as T(c)), 'xuehong31.html'),
(1, 32, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong32.html', SINGLE_CLOB) as T(c)), 'xuehong32.html'),
(1, 33, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong33.html', SINGLE_CLOB) as T(c)), 'xuehong33.html'),
(1, 34, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong34.html', SINGLE_CLOB) as T(c)), 'xuehong34.html'),
(1, 35, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong35.html', SINGLE_CLOB) as T(c)), 'xuehong35.html'),
(1, 36, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong36.html', SINGLE_CLOB) as T(c)), 'xuehong36.html'),
(1, 37, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\xuehong\xuehong37.html', SINGLE_CLOB) as T(c)), 'xuehong37.html')
go
INSERT tblDemoContent(bookid, chapter, content, fileName) values
(2, 1, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin01.html', SINGLE_CLOB) as T(c)), 'liangji01.html'),
(2, 2, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin02.html', SINGLE_CLOB) as T(c)), 'liangji02.html'),
(2, 3, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin03.html', SINGLE_CLOB) as T(c)), 'liangji03.html'),
(2, 4, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin04.html', SINGLE_CLOB) as T(c)), 'liangji04.html'),
(2, 5, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin05.html', SINGLE_CLOB) as T(c)), 'liangji05.html'),
(2, 6, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin06.html', SINGLE_CLOB) as T(c)), 'liangji06.html'),
(2, 7, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin07.html', SINGLE_CLOB) as T(c)), 'liangji07.html'),
(2, 8, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin08.html', SINGLE_CLOB) as T(c)), 'liangji08.html'),
(2, 9, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin09.html', SINGLE_CLOB) as T(c)), 'liangji09.html'),
(2, 10, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin10.html', SINGLE_CLOB) as T(c)), 'liangji10.html'),
(2, 12, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin11.html', SINGLE_CLOB) as T(c)), 'liangji11.html'),
(2, 12, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin12.html', SINGLE_CLOB) as T(c)), 'liangji12.html'),
(2, 13, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin13.html', SINGLE_CLOB) as T(c)), 'liangji13.html'),
(2, 14, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin14.html', SINGLE_CLOB) as T(c)), 'liangji14.html'),
(2, 15, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin15.html', SINGLE_CLOB) as T(c)), 'liangji15.html'),
(2, 16, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin16.html', SINGLE_CLOB) as T(c)), 'liangji16.html'),
(2, 17, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin17.html', SINGLE_CLOB) as T(c)), 'liangji17.html'),
(2, 18, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin18.html', SINGLE_CLOB) as T(c)), 'liangji18.html'),
(2, 19, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin19.html', SINGLE_CLOB) as T(c)), 'liangji19.html'),
(2, 20, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin20.html', SINGLE_CLOB) as T(c)), 'liangji20.html'),
(2, 22, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin21.html', SINGLE_CLOB) as T(c)), 'liangji21.html'),
(2, 22, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin22.html', SINGLE_CLOB) as T(c)), 'liangji22.html'),
(2, 23, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin23.html', SINGLE_CLOB) as T(c)), 'liangji23.html'),
(2, 24, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin24.html', SINGLE_CLOB) as T(c)), 'liangji24.html'),
(2, 25, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin25.html', SINGLE_CLOB) as T(c)), 'liangji25.html'),
(2, 26, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin26.html', SINGLE_CLOB) as T(c)), 'liangji26.html'),
(2, 27, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin27.html', SINGLE_CLOB) as T(c)), 'liangji27.html'),
(2, 28, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin28.html', SINGLE_CLOB) as T(c)), 'liangji28.html'),
(2, 29, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin29.html', SINGLE_CLOB) as T(c)), 'liangji29.html'),
(2, 30, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin30.html', SINGLE_CLOB) as T(c)), 'liangji30.html'),
(2, 32, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin31.html', SINGLE_CLOB) as T(c)), 'liangji31.html'),
(2, 32, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin32.html', SINGLE_CLOB) as T(c)), 'liangji32.html'),
(2, 33, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin33.html', SINGLE_CLOB) as T(c)), 'liangji33.html'),
(2, 34, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin34.html', SINGLE_CLOB) as T(c)), 'liangji34.html'),
(2, 35, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin35.html', SINGLE_CLOB) as T(c)), 'liangji35.html'),
(2, 36, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin36.html', SINGLE_CLOB) as T(c)), 'liangji36.html'),
(2, 37, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin37.html', SINGLE_CLOB) as T(c)), 'liangji37.html'),
(2, 38, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin38.html', SINGLE_CLOB) as T(c)), 'liangji38.html'),
(2, 39, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin39.html', SINGLE_CLOB) as T(c)), 'liangji39.html'),
(2, 40, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin40.html', SINGLE_CLOB) as T(c)), 'liangji40.html'),
(2, 42, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin41.html', SINGLE_CLOB) as T(c)), 'liangji41.html'),
(2, 42, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin42.html', SINGLE_CLOB) as T(c)), 'liangji42.html'),
(2, 43, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin43.html', SINGLE_CLOB) as T(c)), 'liangji43.html'),
(2, 44, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin44.html', SINGLE_CLOB) as T(c)), 'liangji44.html'),
(2, 45, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin45.html', SINGLE_CLOB) as T(c)), 'liangji45.html'),
(2, 46, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin46.html', SINGLE_CLOB) as T(c)), 'liangji46.html'),
(2, 47, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin47.html', SINGLE_CLOB) as T(c)), 'liangji47.html'),
(2, 48, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin48.html', SINGLE_CLOB) as T(c)), 'liangji48.html'),
(2, 49, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin49.html', SINGLE_CLOB) as T(c)), 'liangji49.html'),
(2, 50, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin50.html', SINGLE_CLOB) as T(c)), 'liangji50.html'),
(2, 52, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin51.html', SINGLE_CLOB) as T(c)), 'liangji51.html'),
(2, 52, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin52.html', SINGLE_CLOB) as T(c)), 'liangji52.html'),
(2, 53, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin53.html', SINGLE_CLOB) as T(c)), 'liangji53.html'),
(2, 54, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin54.html', SINGLE_CLOB) as T(c)), 'liangji54.html'),
(2, 55, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin55.html', SINGLE_CLOB) as T(c)), 'liangji55.html'),
(2, 56, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin56.html', SINGLE_CLOB) as T(c)), 'liangji56.html'),
(2, 57, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin57.html', SINGLE_CLOB) as T(c)), 'liangji57.html'),
(2, 58, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin58.html', SINGLE_CLOB) as T(c)), 'liangji58.html'),
(2, 59, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin59.html', SINGLE_CLOB) as T(c)), 'liangji59.html'),
(2, 60, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin60.html', SINGLE_CLOB) as T(c)), 'liangji60.html'),
(2, 62, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin61.html', SINGLE_CLOB) as T(c)), 'liangji61.html'),
(2, 62, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin62.html', SINGLE_CLOB) as T(c)), 'liangji62.html'),
(2, 63, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin63.html', SINGLE_CLOB) as T(c)), 'liangji63.html'),
(2, 64, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin64.html', SINGLE_CLOB) as T(c)), 'liangji64.html'),
(2, 65, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin65.html', SINGLE_CLOB) as T(c)), 'liangji65.html'),
(2, 66, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin66.html', SINGLE_CLOB) as T(c)), 'liangji66.html'),
(2, 67, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin67.html', SINGLE_CLOB) as T(c)), 'liangji67.html'),
(2, 68, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin68.html', SINGLE_CLOB) as T(c)), 'liangji68.html'),
(2, 69, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin69.html', SINGLE_CLOB) as T(c)), 'liangji69.html'),
(2, 70, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin70.html', SINGLE_CLOB) as T(c)), 'liangji70.html'),
(2, 72, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin71.html', SINGLE_CLOB) as T(c)), 'liangji71.html'),
(2, 72, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin72.html', SINGLE_CLOB) as T(c)), 'liangji72.html'),
(2, 73, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin73.html', SINGLE_CLOB) as T(c)), 'liangji73.html'),
(2, 74, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin74.html', SINGLE_CLOB) as T(c)), 'liangji74.html'),
(2, 75, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin75.html', SINGLE_CLOB) as T(c)), 'liangji75.html'),
(2, 76, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin76.html', SINGLE_CLOB) as T(c)), 'liangji76.html'),
(2, 77, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin77.html', SINGLE_CLOB) as T(c)), 'liangji77.html'),
(2, 78, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin78.html', SINGLE_CLOB) as T(c)), 'liangji78.html'),
(2, 79, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin79.html', SINGLE_CLOB) as T(c)), 'liangji79.html'),
(2, 80, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin80.html', SINGLE_NCLOB) as T(c)), 'liangji80.html'),
(2, 82, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin81.html', SINGLE_CLOB) as T(c)), 'liangji81.html'),
(2, 82, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin82.html', SINGLE_CLOB) as T(c)), 'liangji82.html'),
(2, 83, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin83.html', SINGLE_CLOB) as T(c)), 'liangji83.html'),
(2, 84, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin84.html', SINGLE_CLOB) as T(c)), 'liangji84.html'),
(2, 85, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin85.html', SINGLE_CLOB) as T(c)), 'liangji85.html'),
(2, 86, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin86.html', SINGLE_CLOB) as T(c)), 'liangji86.html'),
(2, 87, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin87.html', SINGLE_CLOB) as T(c)), 'liangji87.html'),
(2, 88, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin88.html', SINGLE_CLOB) as T(c)), 'liangji88.html'),
(2, 89, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin89.html', SINGLE_CLOB) as T(c)), 'liangji89.html'),
(2, 90, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin90.html', SINGLE_CLOB) as T(c)), 'liangji90.html'),
(2, 92, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin91.html', SINGLE_CLOB) as T(c)), 'liangji91.html'),
(2, 92, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin92.html', SINGLE_CLOB) as T(c)), 'liangji92.html'),
(2, 93, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin93.html', SINGLE_CLOB) as T(c)), 'liangji93.html'),
(2, 94, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin94.html', SINGLE_CLOB) as T(c)), 'liangji94.html'),
(2, 95, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin95.html', SINGLE_CLOB) as T(c)), 'liangji95.html'),
(2, 96, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin96.html', SINGLE_CLOB) as T(c)), 'liangji96.html'),
(2, 97, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin97.html', SINGLE_CLOB) as T(c)), 'liangji97.html'),
(2, 98, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin98.html', SINGLE_CLOB) as T(c)), 'liangji98.html'),
(2, 99, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin99.html', SINGLE_CLOB) as T(c)), 'liangji99.html'),
(2, 100, (select c from openrowset(bulk N'C:\Public\eBooks\YiFanShuKu\liangjin\liangjin100.html', SINGLE_CLOB) as T(c)), 'liangji100.html')
go
--------------------------------------------------
-- Create fulltext index on textual column
--------------------------------------------------
--drop fulltext index on tblDemoContent
--go
CREATE FULLTEXT INDEX ON tblDemoContent(content)
--(content LANGUAGE 'Simplified Chinese')
KEY INDEX pk_tbl_DemoContent
GO
--------------------------------------------------
-- Run a fulltext query
--------------------------------------------------
select c.*
from tblDemoContent c, tblDemoBook b
where c.bookid = b.id
and b.title = '雪白血红'
and contains(c.content, N'杜聿明')
go
---------------------------------------------------
-- Example of mixed relational and fulltext queries
---------------------------------------------------
select * from tblDemoContent
where contains(content, N'林彪')
and chapter < 6
go
select * from tblDemoContent
where contains(content, N'林彪')
and fileName like 'xuehong08.html'
go
--------------------------------------------------
-- Query directly about keywords and its frequency
--------------------------------------------------
select *
from sys.dm_fts_index_keywords(DB_ID('ftDemoDatabase'), OBJECT_ID('dbo.tblDemoContent'))
where display_term = N'林彪'
go
select *
from sys.dm_fts_index_keywords_by_document(DB_ID('ftDemoDatabase'), OBJECT_ID('dbo.tblDemoContent'))
go
-- list all languages supported in SQL
select * from sys.syslanguages
go