Just for future reference. If you have a software vendor who insists on storing zipcodes as integers, such that the leading zeroes of zipcodes from your clients in say, New Jersey and Mass are truncated, and such that if a zip is not entered you end up with a default value of zero in the field, and you need to pull them out, fix the zeroes, and display them on the report...well here's a little snippet I worked up for our data analyst today.

And it made me ill that I had to do this.  What a hack.  And by hack, I mean our vendor.

select      
case len(zipcode)
when 4 then '0' + convert(varchar, zipcode)
when 5 then convert(varchar,zipcode)
else '00000'
end
from
patient
 

Now Watching: Movie - Godsend