How can I summarize this code?
...
where
code LIKE 'TTAD%'
or
code LIKE 'TTAG%'
or
code LIKE 'TTAW%'
or
code LIKE 'TTE%'
or
code LIKE 'TTK%'
I write this:
...
where
Code LIKE 'TT[AD,AG,AW,E,K]%'
but, I don't want this code returns, for example, 'TTAK' or 'TTEK'.
1条答案
按热度按时间eqoofvh91#
SQL Server does not natively support regex, so the best we can probably do using the enhanced
LIKE
operator is:Note that the above does in fact match
TTEK
. If you want to exclude that, you use: