Retain Leading Zeros when exporting from SQL to Excel

I currently have a field in my database; ZIP Code and it is formatted as char(10).
When I run my query in ssrs, I get the leading zero.
But when I export it to excel, it disappears.

Is there a way I can keep the leading zero when I export?
metalteckAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PortletPaulfreelancerCommented:
that is an Excel issue, not SSRS or SQL

the file should still have the leading zeros in it but Excel "formats" the cells as numbers which makes them disappear

You have to convince Excel that the colunm is text, one  possible method (untested) would be to concatenate the code with a single quote character.

e.g.
instead of:
00050
try:
'00050
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
chaauCommented:
How do you export the data? What tool do you use?
0
Docteur_ZCommented:
In excel you can have special formats with the numbers of zeros you want.
For ex:
format is 00000
1 => 00001
99999 => 99999

You even have in Cell Format / Number  / Category = Special / Type = Postal Code
0
Vitor MontalvãoMSSQL Senior EngineerCommented:
metalteck, do you still need help with this question?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.