1

See the below example

where '1|2|||1|' like '%%|%%|%%|%%|[^3]|' /* it will return true if the string between last two pipe symbols is not like '3'*/

The above code just works fine.

In the same way I need to build a expression for the string between last two pipes not like 10 or 11. Or at least not like 10. So tried like below.

where '1|2|||8|' like '%%|%%|%%|%%|[^10]|'

The above statement return false for 1,0 and 10 instead of just 10. so the above query considers 1 as a separate string and 0 as a separate string. I'm expecting a expression which will return false only if the string between last two pipe is 10. not for 1 or 0.

I also tried using curly braces. But it behaving differently.

  where '1|2|||8|' like '%%|%%|%%|%%|[{^10}]|

Also if you can derive a expression for - string between last two pipe should not be 10 or 11.

Note: I cannot use 'OR' or 'NOT LIKE' in the query.

Any ideas?

4

1 回答 1

2

You need to check each characters separately

Like "...Not 1 followed by not (0 or 1)"

where '1|2|||8|' like '%%|%%|%%|%%|[^1][^01]|'
于 2013-05-15T12:24:04.030 回答