Forum Replies Created

Viewing post 1 (of 1 total)

  • RE: Function for String Occurences Count

    Nice but can't help but feel it's overcomplicating it a bit. What about:

    DECLARE @ReturnValue AS INT

    SET @ReturnValue = 0

    IF LEN(@SearchString) > 0

    BEGIN

    SET @ReturnValue = (LEN(@InputString) - LEN(REPLACE(@InputString,@SearchString,''))) / LEN(@SearchString)

    END

    RETURN @ReturnValue

Viewing post 1 (of 1 total)