September 19th, 2011, 03:35 PM
Data Types For Phone Numbers
Just wondering what data type do you suggest if I'm trying to store phone numbers in ANSI SQL but specifically on a PostgreSQL database. They're all local 10 digit numbers so I was just going to do with CHAR or VARCHAR but I don't know if there's a recommended ANSI SQL data type I should use if I'm storing numbers like 5554566789 or 555-456-6789. Do you guys have any suggestions for me? Sorry this is the 1st time I've ever managed a database that required this data type.
September 19th, 2011, 03:38 PM
I store them like this  and format them when I use them. I use validation to make sure they give me ten digits.
September 19th, 2011, 03:44 PM
eeeww, i don't like storing square brackets
Originally Posted by Vomster
the secret to phone numbers is to use VARCHAR
September 19th, 2011, 03:49 PM
Just curious why you recommend VARCHAR and if you do use it to store phone #'s, do you enter them in as 10 digits with no other characters? I know there's no correct or wrong way to do this but I like to know what is best practice among people who are more familiar with SQL than myself.
September 19th, 2011, 04:18 PM
Originally Posted by CarlosinFL
905 555-0937 ext 42
Comments on this post
September 20th, 2011, 10:08 PM
And what about mobile/cell numbers? Where I live, they are totally different to landline numbers - a different number of digits to landline numbers. And a lot of small businesses only have mobile/cell numbers. Go for varchar.