数据量大,求各位大虾门帮忙提个优化方案!SELECT TOP 10 ID,Title
FROM T_Info
WHERE (KeyWord LIKE '%人%') OR
(Title LIKE '%人%') OR
(KeyWord LIKE '%我%') OR
(Title LIKE '%我%') OR
(KeyWord LIKE '%知道%') OR
(Title LIKE '%知道%')
ORDER BY ID DESC
FROM T_Info
WHERE (KeyWord LIKE '%人%') OR
(Title LIKE '%人%') OR
(KeyWord LIKE '%我%') OR
(Title LIKE '%我%') OR
(KeyWord LIKE '%知道%') OR
(Title LIKE '%知道%')
ORDER BY ID DESC
drop table testftcreate table testft(
id int identity(1,1) constraint pk_testft primary key,
title nvarchar(500),
content nvarchar(2000)
)insert into testft values ('This is title', 'this is content')
insert into testft values ('My name is sqlserver', 'Hello, everyone')
insert into testft values ('这里是标题','这里是内容')
insert into testft values ('江西', '南昌')
insert into testft values ('湖南', '长沙')
insert into testft values ('河南', '郑州')execute sp_fulltext_database 'enable'execute sp_fulltext_catalog 'ft_testft', 'CREATE'execute sp_fulltext_table 'testft', 'CREATE', 'ft_testft', 'pk_testft'execute sp_fulltext_column 'testft', 'title', 'ADD'
execute sp_fulltext_column 'testft', 'content', 'ADD'execute sp_fulltext_table 'testft', 'ACTIVATE'execute sp_fulltext_catalog 'ft_testft', 'START_FULL'--执行完以上语句,再执行以下语句
--查询:declare @keyword varchar(50)
set @keyword = '南'
select * from testft
select * from testft where contains(*, @keyword)--引用自 netcoder(朱二)
SELECT *
FROM 表
WHERE CONTAINS (KeyWord, '("人" or "我" or "知道") AND NOT "适合"')