Re: Rewrite a WHERE clause



SQL programmers tend to trust the optimizer rather than write programs
that change on the fly. We also like the easiest to read form of
identical expressions:

county LIKE COALESCE (@my_county, '%')

Go with this and let the compiler figure out if the parameter is a
NULL, a string or a pattern. The LIKE predicate generates a simple
finite state machine to parse a string using the pattern given. The
state machine for '%' is very fast.

.



Relevant Pages

  • Re: Proving a Language Regular
    ... Bernd L wrote: ... they do have the pattern given by R. I also made up a string according ... It looks to me as though the state machine would have a total of four ...
    (comp.theory)
  • Re: Pattern match question
    ... Pattern matching is done with something called regular language recognition. ... automata". ... By implementing a little state machine, ...
    (comp.lang.cpp)