Pradeep
Pradeep

Reputation: 6613

sql not case sensitive query without using upper or lower function

I have following query ,

select * from process where name like 'abc';

now the name can be abc or ABC or Abc or aBc , any combination ,

i can not use upper and lower function as this query gets passed to some another system which does not support such functions ,

Also, collate is not supported i.e. i can not do ,eg .

select * from process where name like 'abc' COLLATE SQL_Latin1_General_CP1_CI_AS

Is there any way to make this query case-insensitive without using upper and lower functions ?

Upvotes: 3

Views: 1937

Answers (2)

Roberto Garcia
Roberto Garcia

Reputation: 1

this should work:

select * from process where name rlike '[aA][bB][cC]'

Upvotes: 0

aF.
aF.

Reputation: 66747

If we can't use:

  1. lower or upper
  2. assing case insensitive collate

Possibly combining all results:

select * from process where name in ('abc', 'aBc', 'ABc', 'aBC', 'abC', 'AbC', 'aBC', 'ABC')

Upvotes: 1

Related Questions