Code:
... WHERE col LIKE CAST(? AS CHAR(30))
This will most likely not give the desired result:
suppose the host variable has the following content: '%MANN'
then the WHERE clause will see LIKE '%MANN '
(i.e., with 25 spaces at the end), and a match will only be found when there are exactly 25 spaces after MANN.
You could maybe try something like
Code:
WHERE col LIKE RTRIM(?)