All Forums Analytics
ThisIsBob 6 posts Joined 09/06
03 Feb 2010
Search Test String for Column Values

I need to search a VARCHAR(256) column for values stored in another table. Any thoughts?Something like this:select text_stringfrom table1where text_string like any (select empnum from table2)Note that table2 has something like 4MM rows...BobL

dnoeth 4628 posts Joined 11/04
03 Feb 2010

Hi Bob,your syntax is already close: select text_stringfrom table1where text_string like any (select '%' || trim(empnum) || '%' from table2)But of course this will result in a CROSS JOIN.But the main question is: Why do you need to run that stupid query? The data model seems to be quite bad.Dieter

Dieter

ThisIsBob 6 posts Joined 09/06
03 Feb 2010

The business partner is looking for employee numbers that are part of a comment. Stupid, yes; necessary, yes!Thanks. I'll try this out.

You must sign in to leave a comment.