Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 SSIS Export to Excel Zipcode Column

Author  Topic 

albertkohl
Aged Yak Warrior

740 Posts

Posted - 2012-12-06 : 17:27:25
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

52326 Posts

Posted - 2012-12-07 : 08:24:11
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

740 Posts

Posted - 2012-12-07 : 09:18:34
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

52326 Posts

Posted - 2012-12-07 : 09:34:24
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

740 Posts

Posted - 2012-12-07 : 09:53:45
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

52326 Posts

Posted - 2012-12-07 : 11:41:53
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

740 Posts

Posted - 2012-12-07 : 11:58:47
yes, but the column in excel has to be formatted as general, with the zipcode mask.
Go to Top of Page
   

- Advertisement -