SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 SSIS Export to Excel Zipcode Column
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

albertkohl
Aged Yak Warrior

USA
738 Posts

Posted - 12/06/2012 :  17:27:25  Show Profile  Visit albertkohl's Homepage  Reply with Quote
question of the day, how can i export my zipcode column in zip format? so not text, but not numeric either. so basically same is if i select a column in excel, format cells... and set it to Special > Zip Code


Any Ideas?

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 12/07/2012 :  08:24:11  Show Profile  Reply with Quote
howzz data coming from source? if you want to enforce a pattern use regular expression

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

albertkohl
Aged Yak Warrior

USA
738 Posts

Posted - 12/07/2012 :  09:18:34  Show Profile  Visit albertkohl's Homepage  Reply with Quote
it's in a sql database, column is currently formatted as CHAR(5).

how can i export it to excel with a regular expression?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 12/07/2012 :  09:34:24  Show Profile  Reply with Quote
hmm...do you mean after export it needs to have predefined format? whats the format you're looking at? how are values in SQL table?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

albertkohl
Aged Yak Warrior

USA
738 Posts

Posted - 12/07/2012 :  09:53:45  Show Profile  Visit albertkohl's Homepage  Reply with Quote
yes. in SQL it's a zipcode fields. so states like NJ for example, could be 01234. most states are 12345 kinda format. when it dumps into excel. the NJ zipcode for example would be 1234 instead of 01234. which will mess up the import on the other side. i've found a vb script that'll fix it, but it's ugly, and seems kinda, well, half-assed...
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52249 Posts

Posted - 12/07/2012 :  11:41:53  Show Profile  Reply with Quote
then is it matter of exporting it as text rather than number?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

albertkohl
Aged Yak Warrior

USA
738 Posts

Posted - 12/07/2012 :  11:58:47  Show Profile  Visit albertkohl's Homepage  Reply with Quote
yes, but the column in excel has to be formatted as general, with the zipcode mask.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000