SQLTeam.com | Weblogs | Forums

Header in export file is changd from #DL to .DL


#1

Hello,

I am using a SQL statement to write data to CSV file.
The sql statement starts with
SELECT "PRESV01" AS [#DL], PHDCFG_UF_TAGSYNC_STAGE.TAGNAME AS Item,
The header in the CSV file must start with #DL to allow successful import in destination program.
For some reason the created CSV file does not start with #DL in header, but with .DL

Does anyone knows the reason why # is replaced with . in the CSV file?


#2

How is the data getting from your SELECT query into the file? Perhaps whatever utility / program is actually exporting the data to the CSV file is making that change from "#" to "." ?


#3

The program that is using this SQL statement is a simple MS access program

Groetjes,
Jan Guilliams

Hoogbroek 21
3700 Tongeren - Lauw
012/262010
Gsm 0479/023415


#4

I reckon that that is mangling the "#" for some reason.


#5

I suggest you use SSIS or BCP.


#6

I am using the following command in access to create the file out of the SQL statement:
DoCmd.TransferText acExportDelim

When looking at the table in access, the first header is "#DL", but in the file it appears at ".DL"


#7

I faced a similar issue where I had to provide data to a vendor application that required specific column header values. We were using SSRS to export the data to CSV but I don't see how you can't use a similar solution where the client application complains about the values in your headers.

Select your column headers then union the actual values such as this:

SELECT ColumnHeader1, ColumnHeader2, ColumnHeader#
UNION ALL
SELECT ColumnValue1, ColumnValue2, ColumnValue3

Then turn off the column header values in the export file and the first SELECT statement gives you the "header" values you need.

You may have to fight with data type issues. If you can turn it into a VIEW it helps too. It allowed us to solve our problem of providing header values that were normally not supported.