Jeff Maass Blog

My momma always said share.

Cleaning a Phone Number with a Function

Not much more to say other than, taking the resources - CPU, Memory, Time to loop through the characters in a phone number and retrieving all #’s is better than crap. Don’t blame me, blame the designer who allowed a phone number to be stored as varchar with no constraints.

Oh, and maybe since we’re talking varchar, you can’t get crazy and replace | with 1 and Oo with 0 and all that other stuff we DBA’s LOVE to do.  Crap is crap.

When I looked on the web, I found this post and liked the last posted script the best: http://sqljunkies.com/Forums/ShowPost.aspx?PostID=11222

Legacy Comments


Madhivanan
2008-02-26
re: Cleaning a Phone Number with a Function
Also refer
http://sqlblogcasts.com/blogs/madhivanan/archive/2007/12/18/extract-only-numbers-from-a-string.aspx

Jeff M
2008-02-26
re: Cleaning a Phone Number with a Function
Madhivanan: Thanks!