create function fn_find(@find varchar(8000), @str varchar(8000), @n smallint) returns int as begin if @n < 1 return (0) declare @start smallint, @count smallint, @index smallint, @len smallint set @index = charindex(@find, @str) if @index = 0 return…