Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Deleting unwanted characters in a field

Deleting unwanted characters in a field

Deleting unwanted characters in a field

Hello ISQL people,

This is probably an easy one but I'm finding it difficult since I am not too great at ISQL.  I have a field that contains phone numbers and want to delete the ( ) -.  

ex..  (212)555-1212 needs to be 2125551212

I can do this in T-SQL
update stage_guest
set phone = replace(phone,'(','')
update stage_guest
set phone = replace(phone,')','')
 update stage_guest
set phone = replace(phone,'-','')

Anyone have an ISQL (Interbase 5.5) method?
I would appreciate any assistance, Thanks!

RE: Deleting unwanted characters in a field

See the UDF keyword ).
Download and install the 'free UDF library' or 'rFunc UDF library'. You can find in both package enhanced string functions like replace.

RE: Deleting unwanted characters in a field

Thanks otto!  I had run a perl script at interbase to get my results since I had a time frame involved.  
I tried the UDF's on some other test data and suprisngly they work pretty good on data manipulation. Great advice, Thanks!  I didn't know that existed...

FYI for the PERL:

use DBI;
use dbd::odbc;

$dbh = DBI->connect("dbi:ODBC:sourcedb", "username", "password");
#select (id,phone) from guest
$sth = $dbh->prepare("select id,phone from guest");

while (@row = $sth->fetchrow_array)
    if ($row[1] =~ /-/ or $row[1] =~ /\(/ or $row[1] =~ /\)/)   
        print "@row\n";
        $del = $row[1];
        $del =~ s/-//g;
        $del =~ s/\(//g;
        $del =~ s/\)//g;
        print "$del\n";
        $update = $dbh->prepare("update guest set phone = \"$del\" where id = $row[0]");

#update guest
#set phone = $del where id = $row[0]

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close