SQL Server Performance

Don't see the Zero(0) when do select

Discussion in 'SQL Server 2005 T-SQL Performance Tuning' started by avipenina, Jun 15, 2007.

  1. avipenina New Member

    Hi,

    i've create a table that have cell phone column(int) and social_security (int) for my testing environment. the problem is when i add a record that start with the Zero number when i do that SELECT statement i can't see the first Zero number in the results even if i add the number that start with Zero in ('0212545').Why is that?
  2. Madhivanan Moderator

    The int datatype wont store leading zeroes.

    1 If Zip codes have fixed lenght use CHAR(7) and insert values with leading zeroes
    2 If you use front end application, then use INT datatype and when displaying format it there using Format function

    Madhivanan

    Failing to plan is Planning to fail
  3. avipenina New Member

    quote:Originally posted by Madhivanan

    The int datatype wont store leading zeroes.

    1 If Zip codes have fixed lenght use CHAR(7) and insert values with leading zeroes
    2 If you use front end application, then use INT datatype and when displaying format it there using Format function

    Madhivanan

    Failing to plan is Planning to fail
    ok i did change the value from int to char(9) but only if i insert the numbers with '0454654' it show the Zero number but if i insert numbers like that 0454654 it dosen't show the Zero
  4. Madhivanan Moderator

    To add data to CHAR datatype you need to pass value within sigle quote like '0454654'

    Madhivanan

    Failing to plan is Planning to fail
  5. FrankKalis Moderator

Share This Page