• Thanks a lot both of you. it worked. I was thinking that something like this will also work but it didn't 🙁

    create table testing(ID int identity,

    big_number VARCHAR(116) CONSTRAINT CK_big_number CHECK (RIGHT(REPLICATE('0',120) + big_number,116) NOT LIKE '%[^0-9]%'),

    useful_big_number AS RIGHT(REPLICATE('0',120) + big_number,116)

    )

    insert into testing

    select '16456456456456456456456456456456546546456456456456456456'

    union select '2'

    union select '11'

    union select '1'

    select * from testing order by '000000000'+big_number

    Cadavre (2/19/2013)


    Lowell (2/19/2013)


    awesome solution Cadavre!

    only thing i would do is clean up the presentation with REPLICATE to get the zeros, and maybe just a simple not like '%[^0-9]%' ; what do you think of this?

    Replicate is a much better idea, didn't cross my mind. I prefer to use "LIKE" rather than "NOT LIKE" though, despite the extra code.

    Online Trainer For SQL DBA and Developer @RedBushTechnologies with 18 yrs exp.