• There appears to be a bug in the search stored procedure ... it was only searching on the first term given to it in the search string.

    It was also eroding the string by one character every loop, so would break after the padding string was totally eroded away

    To solve the problems change:

    The line:

    SET @kws = SUBSTRING(@kw, CHARINDEX(' ', @kws) + 1, LEN(@kws) - CHARINDEX(' ', @kws) - 1)

    To this (remembering to remove the -1 at the end):

    SET @kws = SUBSTRING(@kws, CHARINDEX(' ', @kws) + 1, LEN(@kws) - CHARINDEX(' ', @kws) )