Hello,

What variable types should I use for phone number. I tried to put integer(20) earlier then, I cannot record : 021888888 since it saves as 21888888

If I choose varchar(20) then it allows alphabets also, which it should.

Any other ideas?

Recommended Answers

All 3 Replies

I'd say that a string type is the most appropriate. You simply need to add in validation in your application to ensure that you only allow input that you expect.

You can use the varchar and money data type.SQL Server also has the money data type which is just like the decimal data type but is a predefined, built-in type, so it only requires 8 bytes to store a four digit extension and a phone number with up to 14 digits.

Varchar DataType is the appropriate one.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.