为何要有下面三个把持了?呵呵,都分明,就不细说了。
*/
begin
if(@artype=0)
begin
set@path=http://www.lmwlove.com/ac/ID717
end
elseif(@artype=1)
begin
set@path=http://www.lmwlove.com/ae/ID32
end
elseif(@artype=2)
begin
set@path=http://www.lmwlove.com/ah/ID31
end
set@str=replace(@str,@k_tag,<ahref="+@path+cast(@aridasvarchar(50))+"target="_blank"class="content_href">+@k_tag+</a>)
insertinto@t_temp_key_tag(temp_keytag,temp_arid)values(@k_tag,@arid)
end
fetchnextfromre_sultinto@k_tag,@artype,@arid
end
closere_sult
deallocatere_sult
return@str
end
该函数的一些逻辑是基于本站数据库布局上的,好比对@artype参数的判别。
函数创立乐成后,还必要在必要主动创立锚文本的表中加上insteadof触发器,主动挪用该函数,举比方下;
createtrigger[dbo].[iti_Ar]on[dbo].[t_Ar]insteadofinsert
as
if@@rowcount=0return
setnocounton