Page 1 of 1

How to Remove Non Numeric?

Posted: Tue Nov 11, 2008 12:22 pm
by dsdoubt
What is the efficient way to remove Non Numeric for a field.

Eg: I need to remove the non numeric character in the Field "No"
Input
-----

Code: Select all

ID | No
1|003A23
2|234-456
3|    2333

Output
--------

Code: Select all

ID | No
1|323
2|234456
3|2333
I dont think I need to specify all the non numeric character in the Convert function to get stripped out.

Posted: Tue Nov 11, 2008 12:56 pm
by ray.wurlod
I think you do, unless you have additional information which you have not shared about the likely non-numeric characters that may appear in the data.

Posted: Tue Nov 11, 2008 3:05 pm
by dsdoubt
I was asking if I need to use Convert function.
If I need to use that, I need to specify all the list of non numeric character in the list. Which I don't want to.

Posted: Tue Nov 11, 2008 4:23 pm
by ray.wurlod
Tough.

Create a stage variable containing a list of them. Initialize it only; you don't need to re-derive for every row processed.

Posted: Tue Nov 11, 2008 4:41 pm
by Mike
How about a double convert to avoid identifying/listing all possible non-numeric characters:

Code: Select all

Convert(Convert("0123456789","",link.column),"",link.column) 
The inner convert keeps the non-numeric characters and the outer convert removes them.

Mike

Posted: Tue Nov 11, 2008 6:27 pm
by chulett
Nice! :D

Posted: Wed Nov 12, 2008 2:12 am
by ray.wurlod
... though computationally intensive.

Posted: Wed Nov 12, 2008 9:16 am
by dsdoubt
Smartie Mike!!!!!

Posted: Thu Feb 21, 2019 12:57 am
by pnpmarques
Still an useful solution after so many years :)