Re: converting integer zipcodes to a 5 character char
Posted by SQL on 10/02/17 11:48
Here is one way
declare @zip int
declare @czip char(5)
select @zip = 2109
select @czip = convert(char, RIGHT('00000' + CONVERT(VARCHAR,@zip),5))
select @czip
Denis the SQL Menace
http://sqlservercode.blogspot.com/