List:General Discussion« Previous MessageNext Message »
From:Dan Bolser Date:April 10 2005 3:10pm
Subject:Find valid numeric values in a string field?
View as plain text  
I have a column like this "my_col varchar(20) null".

The values in the column can be text or numbers. How can I select only
those rows where the value in this column is a valid number?

I need something like IS_DECIMAL(), but I can't find that function.

The following SQL fails to do the job (probably because of
optimization)...

SELECT
  MIXED_COLUMN,
  MIXED_COLUMN + 0
FROM
  TABLE
WHERE
  MIXED_COLUMN =
  MIXED_COLUMN + 0
;

Hey, lets make an IS_DECIMAL UDF! ;)

----

p.s. why aren't the addresses of these mailing lists anywhere to be found
on the MySQL Lists pages?

Dan.

Thread
Find valid numeric values in a string field?Dan Bolser10 Apr
  • Re: Find valid numeric values in a string field?Eamon Daly11 Apr
    • Re: Find valid numeric values in a string field?Dan Bolser11 Apr