The following code returns ALL the rows in the table
ALTER PROCEDURE dbo.crdGLSearchTreeSP
SELECT ..., ....
WHERE (RTRIM(FinanceGroupingName) LIKE '%' + @SearchString
If I replace the @SearchString
with a quoted value, eg LIKE '%' + 'REVENUE'+ '%' it returns as expected - the three records where FinanceGroupingName includes the string REVENUE. The RTRIM() was included after reading BOL but it should not be necessary.
I really appreciate some help in limiting the records using LIKE.