Friday, January 27, 2012

doesn't work in LIKE wildcards?

I have table of stocks that includes a varchar field that can optionally hold
a formula. You can identify formulas because the first character is "=". You
can also include the names of other stocks in the formula by surrounding the
ticker in !'s. For instance:
=!MSFT! * 2
I need to find all the formulas that do contain a ticker in them, so that I
can look up the stocks they refer to.
The obvious solution is ... WHERE formula LIKE '=%!'. The obvious solution
does not work. Removing the ! returns all the formulas. Anyone know what
would cause this? ! does not appear in the docs as a reserved word or
wildcard.
MauryHello Maury,
> I have table of stocks that includes a varchar field that can
> optionally hold a formula. You can identify formulas because the first
> character is "=". You can also include the names of other stocks in
> the formula by surrounding the ticker in !'s. For instance:
> =!MSFT! * 2
> I need to find all the formulas that do contain a ticker in them, so
> that I can look up the stocks they refer to.
> The obvious solution is ... WHERE formula LIKE '=%!'. The obvious
> solution does not work. Removing the ! returns all the formulas.
> Anyone know what would cause this? ! does not appear in the docs as a
> reserved word or wildcard.
> Maury
>
I think it's the fact that you didn't add a trailing %
where formula like %!%
Jesse Houwing
jesse.houwing at sogeti.n|||Ohh geez, nevermind!

No comments:

Post a Comment