Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Padding trailing spaces with zeros in a view

Status
Not open for further replies.

cwolgamott

Programmer
May 29, 2002
69
US
Hello. :) I am trying to create a view using fields in a table. I need to pad spaces with zeros after the field. For example, if the field is: 1234 and the length of the field must be ten digits long, I need it to appear like this: 1234000000. I am able to pad zeros before the field by using:

RIGHT(REPLICATE('0',5) + CONVERT(VARCHAR,NewRead), 5)

(NewRead is the field name)

I must use the field name because not all of the values will be the same length. For example, one could be 1234 and another could be 12345. I would greatly appreciate any suggestions or help. :) Thank you.
 
Thank you so much for your response. :) I greatly appreciate it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top