Change Case of first character of text string

dcpbarrington dpierce at xpertassist.com
Fri Feb 29 14:10:41 EST 2008


Len,  I cannot get your SQL to work on SQLite. Here is my code.

put "SELECT PersonID from Person " into tSQL
put "WHERE tolower( Person.PersonID) = " & tolower(theEnteredLastName) & "'"
after tsQL
put revdb_querylist(,,qLocID, tSQL) into the ID

the Database parser reject the tolower() function, so I tried to use the
ILIKE notation instead of the tolower function and got the same generic
DATABASE ERROR message.  I would like to instruct the database to not be
case sensative on the text match.
Any recommendations?


Len Morgan wrote:
> 
> Is there a reason why you have to capitalize the first letter?  I have a 
> similar feature in my software and I use something like:
> 
> SELECT * FROM people WHERE last_name ILIKE "smith"
> That does a case insensitive search.
> 
> You could also use:
> 
> SELECT * FROM people WHERE tolower(last_name) = tolower('smith')
> 
> or you could try:
> 
> SELECT * FROM people WHERE last_name in ('Smith','SMITH','smith')
> 
> 
> This assumes that you are using "standard" SQL (which your example is 
> not).  Just a little "added" feature of my first example is you could use:
> 
> ...WHERE last_name ILIKE 'smith%'  and get anyone who's name BEGINS with 
> 'smith' (for example Smithe, Smithy...)
> 
> Hope that helps.
> 
> len morgan
> 
>> Works great as long as the user enters the text string in the same case
>> as
>> has been entered in the database.  "Smith" = "Smith", but if the user
>> enters
>> "smith" in the select box, the record is not found.
>>
>> I want to do the database select with different text formats to make sure
>> that the record is found.
>> SELECT on "Smith", "smith", "SMITH"
>>
>> I found the toupper() and tolower() functions, but how do you get the
>> function to change only the first letter toupper in a string?
>>
>> Thanks in advance for the help.  This cannot be that hard.
>>   
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> 

-- 
View this message in context: http://www.nabble.com/Change-Case-of-first-character-of-text-string-tp15748287p15765453.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list