If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Strip unwanted characters from phone no in Informix DB

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-31-08, 14:03
na4rich na4rich is offline
Registered User
 
Join Date: Oct 2003
Location: Glendale california
Posts: 3
Cool Strip unwanted characters from phone no in Informix DB

I need to remove any quotation marks from a phone no ie: (,),- field. The phone numbers are in the database as a string. I need to end up with only 10 numbers, then format this field as 999-999-9999 deleting anything that does not match. Please help I am a novice in SQL.
Reply With Quote
  #2 (permalink)  
Old 01-08-09, 03:53
stanislav.ondac stanislav.ondac is offline
Registered User
 
Join Date: Aug 2005
Posts: 140
you can use REPLACE sql function.

insert into new_table
select replace(no,'-','') from old_table;

or

update old_table set no=replace(no,'-','');

unfortunately there is no built-in support for regular expressions, so you have to user replace function for every different character you want to remove.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On