Your fr_reverse_charIndex function can be rewritten as:
alter function [dbo].[fn_reverse_charIndex]
/*********************************************************/
/* CREATE fn_reverse_charIndex */
/* ---------------- COMMENTS ------------------------ */
/* Give the last occurrence of the character passed in */
/* ---------------- HISTORY LOG ------------------------ */
/*********************************************************/
( @char char(1), @expression varchar(255))
returns int
as
begin
ifcharindex(@char,reverse(@expression)) = 0 return 0
return len(@expression) - charindex(@char,reverse(@expression)) + 1
end