why int data type field won't accept 0 as starting number ex: 03451

  • Hi all,

    create table #temp

    (

    id int

    )

    insert into #temp

    select 0

    insert into #temp

    select 2

    insert into #temp

    select 01234

    select * from #temp

    in the above example why it wont accept 0 as starting number ?

  • Because numbers don't have leading zeros. If I'm discussing a rugby match score, I'm not going to say it as 009 to 011. Talking about the number of people in the room, there weren't 0015, there were 15.

    If a leading zero is meaningful, that's not a number, that's a string.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Okay .

    Thank you very much .

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply