MySQL function?

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Derek Neighbors
Date:  
Subject: MySQL function?
Mike Starke said:
>
> Is there a function in MySQL similar to that in Excel's "proper()"?
>
> For instance, I would like to do a select on a column that has
> all CAPS and display the query in proper case (Mike versus MIKE).


I don't think it has such a function. I double checked their manual[0] to
be sure before putting up flame fodder.... I did not see it there.

However, if you were interested in using Postgres instead, it does have
this function[1]...

initcap() initializes first letter of each work to uppercase.

So initcap(lower('MIKE')) would produce you Mike as desired...

Last I checked MySQL didnt support stored procedures[2] or I would tell
you to write your own "stored procedure" to mimic the functionality.
There are ways around it you could do either programmatically after you
have a returned result set or through utter bastardization of existing
string functions available. Again my primary suggestion would be to move
to Postgres or if you insist on using MySQL switch to MaxDB[3] (formerly
SAP-DB) the replacement to MySQL.

-Derek

[0] http://www.mysql.com/doc/en/String_functions.html
[1] http://www.postgresql.org/docs/7.3/interactive/functions-string.html
[2] http://www.mysql.com/doc/en/ANSI_diff_Triggers.html
[3] http://www.mysql.com/newsletter/2003-05/a0000000166.html