Add Leading 0s

  • I have a column that is numeric(9) and can have values up to 999999999999. I need to add 0's to padd the 13 places. Eg. 0000000000123 or 00001234556789. Please advise.

    Thanks,
    Art
    Database Analyst
    Tastefully Simple, Inc.

    alorenzini@tastefullysimple.com
    " Some days, it's not even worth chewing through the restraints!

  • right('0000000000000' + cast(number_col as varchar), 13)

  • Perfect. Thanks.

    Thanks,
    Art
    Database Analyst
    Tastefully Simple, Inc.

    alorenzini@tastefullysimple.com
    " Some days, it's not even worth chewing through the restraints!

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

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