Matthew van Eerde wrote:
where 'myfoo' like '%' + col1 + '%'
-- returns rows where col1 is any of:
-- ''
-- m
-- y
-- f
-- o
-- my
-- yf
-- fo
-- oo
-- myf
-- yfo
-- foo
-- myfo
-- yfoo
-- myfoo
This didn't seem to work on my live pgsql database. It seems confused over the + operator in the like clause:
ERROR: operator does not exist: "unknown" + character varying
SQL state: 42883
Hint: No operator matches the given name and argument type(s). You may need to add explicit type casts.
Edit: Though if this works on MS SQL, perfect, because I will have to port this to work on MS SQL and Oracle at some point.