Case insensitive search on Sybase

Dchucks picture Dchucks · Sep 17, 2008 · Viewed 8k times · Source

I have been sick and tired Googling the solution for doing case-insensitive search on Sybase ASE (Sybase data/column names are case sensitive). The Sybase documentation proudly says that there is only one way to do such search which is using the Upper and Lower functions, but the adage goes, it has performance problems. And believe me they are right, if your table has huge data the performance is so awkward you are never gonna use Upper and Lower again. My question to fellow developers is: how do you guys tackle this?

P.S. Don't advise to change the sort-order or move to any other Database please, in real world developers don't control the databases.

Answer

Bipin Daga picture Bipin Daga · Jun 22, 2010

Try creating a functional index, like

Create Index INDX_MY_SEARCH on TABLE_NAME(LOWER(@MySearch)