创建全文索引的sql语句和测试sql语句执行时间

--USE EGDB_HZZ;
--GO
--DROP FULLTEXT CATALOG ftCatalog
--CREATE FULLTEXT CATALOG ftCatalog AS DEFAULT;

--GO
--CREATE FULLTEXT INDEX ON MENU_PERM (PERM_NAME LANGUAGE 0x804 ) KEY INDEX PK_MENU_PERM;---为表创建全文索引
--GO
--EXEC sp_fulltext_column 'MENU_PERM', PERM_NAME, 'add',2052;--把指定列添加上去,指定为中文
--GO

 

--SELECT stopword FROM sys.fulltext_stopwords WHERE language_id = 2052 and stopword=''


declare @d datetime
set @d=getdate()
--select PERM_NAME as [result] from MENU_PERM where PERM_NAME like '%应急%'
--SELECT PERM_NAME FROM MENU_PERM WHERE freetext(PERM_NAME, '"急"')

SELECT PERM_NAME as [result] From MENU_PERM
inner join
--containstable(MENU_PERM,PERM_NAME,'"应急" or "资料"',500) as k on MENU_PERM.PK_PERM_ID = k.[key] where LEN(PERM_NAME)<=4 ORDER BY k.RANK DESC
freetexttable(MENU_PERM,PERM_NAME,'"应急" or "资料"',500) as k on MENU_PERM.PK_PERM_ID = k.[key] where LEN(PERM_NAME)<=4 ORDER BY k.RANK DESC
select [语句执行花费时间(毫秒)]=datediff(ms,@d,getdate())

posted on 2013-12-24 15:50  中子持心  阅读(293)  评论(0编辑  收藏  举报

导航