freewzx:
问题:执行此过程非常耗CPU和非常慢,有何更快的办法达到同样目的
[阅读: 351] 2005-10-19 08:09:59
CREATE FUNCTION GetKeywordCount(@string1 varchar(55),@string2 varchar(55))
RETURNS int
AS
BEGIN
DECLARE @KeywordCount int
DECLARE @temp_string1 varchar(255)
DECLARE @i int
DECLARE @l int
SET @temp_string1 = ltrim(rtrim(@string1))
SET @l = len(@string2)
SET @i = 1
SET @KeywordCount = 0
WHILE (@i <= @l)
BEGIN
IF (CharIndex(substring(@string2,@i,2),@temp_string1)>0)
SET @KeywordCount = @KeywordCount + 1
SET @i = @i+1
END
--SET @KeywordCount=len(@string2)
RETURN(@KeywordCount)
END
sub SearchInit()
dim str, l,i,OneChar,qz
str = keyword
Conn_User.execute("update PE_Article_temp set SearchSum =dbo.GetKeywordCount(Title,'"&keyword&"')")
end sub
用途:执行此过程后在ASP中用 select * from pe_article_temp order by searchsum desc 分页显示结果
问题:执行此过程非常耗CPU和非常慢,有何更快的办法达到同样目的,想做到象BAIDU的查询效果