From: Claudio Nanni Date: October 15 2009 9:56am Subject: Re: is_string or is_numeric List-Archive: http://lists.mysql.com/mysql/219058 Message-Id: <53bcf3a60910150256j63abd15fyce6c6f79d5b2cce0@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=0014853dfa8b51c72c0475f64be7 --0014853dfa8b51c72c0475f64be7 Content-Type: text/plain; charset=ISO-8859-1 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 > > From: sangprabv > > Subject: is_string or is_numeric > > To: mysql@stripped > > 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=claudio.nanni@stripped > > -- Claudio --0014853dfa8b51c72c0475f64be7--