Subject | RE: [firebird-support] Stripping non numerics from a string column |
---|---|
Author | Nigel Weeks |
Post date | 2007-07-19T23:37:39Z |
You should be able to do it with a simple stored procedure, leveraging the
substr and strlen UDF's that are supplied with Firebird.
Simply traverse your input variable, one character at a time, until you get
to the strlen of it.
For each character, test if it's >=0 and <=9, and if it is, append it to a
temporary variable.
At the end of the procedure, simply suspend the temporary variable to get it
out.
N
Nigel Weeks
Tech Support and Systems Developer
Rural Press Tasmania
The Examiner Newspaper
Ph. 03 6336 7234
Mob. 0408 133 738
Email. <mailto:nweeks@...> nweeks@...
"You may now be on
the other side of the fence,
but the grass is just as likely
to die there too." - nw
_____
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Rich Pinder
Sent: Friday, 20 July 2007 9:00 AM
To: Firebird
Subject: [firebird-support] Stripping non numerics from a string column
I was hoping not to have to write my own function, but I'm not finding
anything build in to help update columns by stripping characters from a
string. I'd like to use SQL alone to accomplish the update.
Phone numbers is the issue
Would like to translate 818) 450-2345 into 8189097749
Generally, anything which is not a numeral (0-9), I'd like to strip
Thanks in advance for any points
Rich Pinder
USC School of Medicine
__________ NOD32 2408 (20070719) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com
[Non-text portions of this message have been removed]
substr and strlen UDF's that are supplied with Firebird.
Simply traverse your input variable, one character at a time, until you get
to the strlen of it.
For each character, test if it's >=0 and <=9, and if it is, append it to a
temporary variable.
At the end of the procedure, simply suspend the temporary variable to get it
out.
N
Nigel Weeks
Tech Support and Systems Developer
Rural Press Tasmania
The Examiner Newspaper
Ph. 03 6336 7234
Mob. 0408 133 738
Email. <mailto:nweeks@...> nweeks@...
"You may now be on
the other side of the fence,
but the grass is just as likely
to die there too." - nw
_____
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Rich Pinder
Sent: Friday, 20 July 2007 9:00 AM
To: Firebird
Subject: [firebird-support] Stripping non numerics from a string column
I was hoping not to have to write my own function, but I'm not finding
anything build in to help update columns by stripping characters from a
string. I'd like to use SQL alone to accomplish the update.
Phone numbers is the issue
Would like to translate 818) 450-2345 into 8189097749
Generally, anything which is not a numeral (0-9), I'd like to strip
Thanks in advance for any points
Rich Pinder
USC School of Medicine
__________ NOD32 2408 (20070719) Information __________
This message was checked by NOD32 antivirus system.
http://www.eset.com
[Non-text portions of this message have been removed]