Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hidden characters in fields and exporting to Excel

Status
Not open for further replies.

wbodger

Programmer
Apr 23, 2007
769
US
I am working on creating an output file script that takes aggregated data and spits out an excel file (creating a data dictionary for statisticians). However, there are some hidden characters that are causing issues when exporting to Excel. Is there a way to handle (remove) those characters without explicitly knowing what they are?

Thanks!

wb
 
All hidden chars are in range from CHAR(0) TO CHAR(31), so you can write a function that REPLACE() these chars with empty string.
Usually the only hiffen chars that you have in such fields are the CR + LF (CHAR(10) + CHAR(13)). Excel didn't like the CHAR(13). It uses only CHAR(10) as end of the line. So first you can try first this:

Code:
SELECT REPLACE(YourCharField,CHAR(13),'') AS YourCharField
FROM YourTable
WHERE ....



Borislav Borissov
VFP9 SP2, SQL Server 2000,2005 & 2008.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top