Create FUNCTION xiangsi
(
@str1 varchar(2500),@str2 varchar(2500)
)
RETURNS int
AS
BEGIN
declare @i int,@c int,@i1 int,@c1 int
select @c=len(@str1),@c1=len(@str2),@i=1,@i1=1
declare @temp table(zf varchar(2),wz int)
declare @temp1 table(zf varchar(2),wz int)
while @i<=@c
begin
insert into @temp select substring(@str1,@i,1),@i
set @i=@i+1
end;
while @i1<=@c1
begin
insert into @temp1 select substring(@str2,@i1,1),@i1
set @i1=@i1+1
end;
return 100*
(
2*(
select count(*) from @temp
where zf in
(
select zf from @temp1
)
)
+
2*(
select count(*) from @temp1
where zf in
(
select zf from @temp
)
)
+
(--同样字符不同位置要有一定影响
select count(*) from @temp