Re: extract numeric value from a string.

2005-04-26 Thread mfatene
I just did the oposite :o) set @a='0123FOO'; set @b=substring(0+concat('9',@a),-length(0+concat('9',@a))+1); select @b,replace(@a,@b,''); have to concat a positive number !!! Selon [EMAIL PROTECTED]: > Hi all, > The trick i can see if the string start with '0' is to make it starting with > a

Re: extract numeric value from a string.

2005-04-26 Thread mfatene
Hi all, The trick i can see if the string start with '0' is to make it starting with a positive number. FOr example if my string is '0123FOO' : set @a='0123FOO'; set @b=substring(0+concat('0',@a),-length(0+concat('0',@a))+1); select @b,replace(@a,@b,''); Mathias Selon gerald_clark <[EMAIL P

Re: extract numeric value from a string.

2005-04-26 Thread Eamon Daly
clark" <[EMAIL PROTECTED]> To: "Eamon Daly" <[EMAIL PROTECTED]> Cc: "dixie" <[EMAIL PROTECTED]>; "MySQL" Sent: Tuesday, April 26, 2005 8:10 AM Subject: Re: extract numeric value from a string. Eamon Daly wrote: Easy enough. Get the numeric

Re: extract numeric value from a string.

2005-04-26 Thread gerald_clark
Eamon Daly wrote: Easy enough. Get the numeric part via CONVERT, then get the rest of the string from the length of the numeric part, plus one: SELECT tag, @num := CONVERT(tag, SIGNED) AS num_part, SUBSTRING(tag, LENGTH(@num) + 1) AS rest_of_string from tags; ++--++

Re: extract numeric value from a string.

2005-04-22 Thread Eamon Daly
Easy enough. Get the numeric part via CONVERT, then get the rest of the string from the length of the numeric part, plus one: SELECT tag, @num := CONVERT(tag, SIGNED) AS num_part, SUBSTRING(tag, LENGTH(@num) + 1) AS rest_of_string from tags; ++--++ | tag| num_par