Im using a SQL SELECT statement to export data from an ADO DataSet to an Excel database. I've accomplished this, but with a flaw. This SQL statement is part of the exporting feature of a program, so a SQL statement revision is needed.
The flaw is that the Field Names (not captions, so I get ExprXXXX for some of them) from the ADO dataset are inserted as the first row of the Excel sheet/table, with the actual data following.
I've played with the select statement and the extended property HDR=YES/NO with no luck.
How do I select the data into the Excel sheet without these annoying column names as the first row?
here is one of the SQL strings I tried:
"SELECT DATATYPE43, DATATYPE44, format(DATATYPE6,'mm/dd/yy'), format(DATATYPE40,'0'), format(DATATYPE41,'0'), format(DATATYPE60,'$###,##0.00'), format(DATATYPE63,'$###,##0.00'), format(DATATYPE64,'$###,##0.00'), format(DATATYPE54,'$###,##0.00') INTO [Excel 8.0; HDR=YES; DATABASE=excell test.xls].[TestSheet5]\r\nFROM DataPumpEntryTable;\r\n"
I played with HDR being yes and no...and removing the format()'s ...and in this example still have the column names removed, they were SELECT DATATYPE43 AS [Machine Name], etc.
For the columns with the format() I get the ExprXXXX. So the first row looks like this, with the data following starting on row 2:
DATATYPE43,,DATATYPE44,Expr1002,Expr1003,Expr1004, Expr1005,Expr1006,Expr1007,Expr1008