I don’t know if I’m seeing a bug in SQLite or if it just acting in a way I don’t understand. I do know it isn’t a Xojo bug but I’m asking about it here since trying to find anything in SQLite documentation is, for me, frustrating.
I have a database that has the following (excerpted) set of rows in the table called ‘Things’:
ID Name
1 Crux
2 Critic
3 C_Calite
If I issue a select statement like
SELECT * FROM Things WHERE Name LIKE 'c%'
I get all three rows returned as I would expect. If, however, I issue a select statement like
SELECT * FROM Things WHERE Name LIKE 'c_%'
I still get all three rows. I expected to get only the third row since it is the only one with the underscore in it.
Is that normal behaviour? If so, is there a “trick” to getting the SELECT statement to distinguish the rows with the underscore?
Thanks, Norman, that works. Now I’m going to have to figure how to incorporate that into some old code in a few dozen places.
Well if it were easy we wouldn’t drive ourselves crazy with it.
Whenever I use LIKE in SQL, unless I’m looking for case-dependencies, I always explicitly lowercase the values in the comparisons, just in case (pun intended).
I’m going to close this down. I decided that the way I was approaching the problem wasn’t the best way so I scrapped it and rewrote the whole shebang. Now, the problem is gone and the routines are faster than before.
Thanks to all and have a Happy Holiday, whichever one(s) you celebrate.