> From: sangprabv <sangpr...@gmail.com>
> Subject: is_string or is_numeric
> To: mysql@lists.mysql.com
> Date: Thursday, 15 October, 2009, 10:34 AM
> Hi,
> I found no built in function in mysql to check whether a
> record is
> numeric or string. Is there any trick to do so? Many
> thanks.

You could use some regex to do it...

In fact, a google brings up this 
(http://forums.mysql.com/read.php?60,1907,241284#msg-241284)

CREATE FUNCTION ISNUMERIC(myVal VARCHAR(1024))
RETURNS TINYINT(1) DETERMINISTIC
RETURN myVal REGEXP '^(-|\\+)?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+|[0-9]+)$';


Glyn




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to