求一段过滤html代码的sql自定义函数
參考答案:create function yanzi
(
@vstrIn varchar(1000)
)
returns varchar(4000)
as
begin
declare @strReturn varchar(4000)
,@str varchar(4000)
,@stmp varchar(1)
,@i int
,@len int
set @strReturn=''
select @str=stuff(@str,1,2,'')
set @len=len(@str)
set @i=1
while @i<@len
begin
set @stmp = substring(@str,@i,1)
set @stmp = replace(@stmp,'<','<')
set @stmp = replace(@stmp,'>','>')
set @strReturn = @strReturn + @stmp
set @i=@i+1
end
return @strReturn
end