What is the DataType for mobile no. in Sql Server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sweatha
    New Member
    • Mar 2008
    • 44

    #1

    What is the DataType for mobile no. in Sql Server

    Hi

    This is sweatha.I have created a table in sql server 2000 using the coding as

    create table login1(lname varchar(20),ema il varchar(35),pas word varchar(10),cpa sword varchar(10),mob ile integer)

    and

    if i give the mobile no with 10 values, then it shows the error as

    "Arithmetic overflow error converting expression to data type int.
    The statement has been terminated."
  • Shashi Sadasivan
    Recognized Expert Top Contributor
    • Aug 2007
    • 1435

    #2
    HI,
    Seeing that int can store a value upto 2,147,483,647

    so if you have a mobile nummber with more than 10 digits 9and beyond that value, it will throw an error.

    Try the bigint as it can store a value upto 9,223,372,036,8 54,775,807

    Though, you may store it as a string, and contraint the string values to be as digits from the application side

    Comment

    • malav123
      New Member
      • Feb 2008
      • 217

      #3
      Hi Swetha,
      I think you should have to use Varchar(n) as datatype of mobile number because some times probably you will have to store mobile number as in "111-111-1111" so at that time int will not work... but by using varchar() you will never get exception....
      I think this will be useful to you.....

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        It is better to store that as string . Because mobile numbers are stored with + and country code .Also refer the format in previous post.

        Comment

        Working...