Cleaning up phone number data imported from Excel. This admittedly ugly script works, but I can't help but wonder if there's a better or more efficient way of doing this than multiple nested calls to the replace() function?
Code:-- clean up data UPDATE prmd_company set phone = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(rtrim(ltrim(phone)), 'Ph: ', ''), '(', ''), ')', ''), '-', ''), 'ext', 'x'), '+', ''), '.', ''), ':', ''), ' ', ''), CHAR(160), ''), fax = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(rtrim(ltrim(fax)), 'Fax: ', ''), '(', ''), ')', ''), '-', ''), 'ext', 'x'), '+', ''), '.', ''), ':', ''), ' ', ''), CHAR(160), ''),




Reply With Quote