Only in the case you want to know the datatype and not the actual type of
information in a char field!

If you issue:

show fields from MyTable like 'FName';

you get:
+-------+--------------+------+-----+---------+-------+
| Field | Type         | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+-------+
| FName | varchar(255) | YES  |     | NULL    |       |
+-------+--------------+------+-----+---------+-------+

although is not a function if you place the result into an array on the
application side you can pull the value of the Type attribute.


Hope this helps anyway!


Claudio


2009/10/15 Glyn Astill <[email protected]>

> > From: sangprabv <[email protected]>
> > Subject: is_string or is_numeric
> > To: [email protected]
> > 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/[email protected]
>
>


-- 
Claudio

Reply via email to