Formatting integer in SSRS with leading zeros

4stars picture 4stars · Jan 18, 2017 · Viewed 7.6k times · Source

I would like to format as 10 digits in total regardless of the length of actual data, filling with leading zeros. Example actual data is 123456, Then my result would be 0000123456. But the actual data has the dynamic length, means we can't guess all the time. Can I achieve in SSRS? Instead of formatting in SQL?

Answer

niktrs picture niktrs · Jan 18, 2017

In the report, set fields formating to as many zeros as the digits you want to appear. For example for 10 digits the format code should be "0000000000"

enter image description here

enter image description here