Click here to Skip to main content
15,901,666 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to add a telephone number begin with zero to a table in the database.I added 0771234567.But when I retrieve the numbers there are only last nine numbers(771234567).No zero.What should I do .I need to work with 0771234567.
Posted

change the telephone number data type by varchar in your database
 
Share this answer
 
v2
Hi Nishan,

Refer the below link to format numbers.

Format Number To Display[^]
 
Share this answer
 
I guess you defined the phone numbers to be integer numbers. When formatted, the leading zeros are discarded.

It is more appropriate to let the phone numbers be character strings.
 
Share this answer
 
Phone numbers can contain other symbols for readability too... a regexp for a phone number looks something like [0-9+-()*#]+. So you need to use a text field for phone numbers, plus some validation.
 
Share this answer
 
hi dear,

Change your Datatype, Because integer value do not Count first Zero ( 0 ) .

if you like your solution plz vote.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900