How can I pad an integer value in SQL Server with zeroes?

Neil Pike

April 8, 1999

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A. By converting to a string and padding that way. e.g. an examplefrom pubs to pad a value :-

select right(replicate('0',10)+convert(varchar(10),ytd_sales),10) from titles

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like