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 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Excel Datasource with no Column Header

Author  Topic 

jsiedliski
Yak Posting Veteran

61 Posts

Posted - 2004-07-01 : 23:03:00
I am trying to automate the importing of an Excel Spreadsheet using DTS (SQL Server 2K). The only issue I currently have is that the source file (the .xls) does not contain any column headers. So, basically row1 contains data (not the header row).

Becuase I want to automate this, I want to be able to import by referencing the columns without having to paste in a header row.

How would I reference the columns in the "Transform Data Task" Source "Sql Statement" section?

I tried (Columns A through G have data)

select `F1`,`F2`,`F3`,`F4`,`F5`,`F6`,`F7` from `SHEET1$`

It does not seem to work for me.

Please help,

Jack

:)

Doug_Bak
Starting Member

9 Posts

Posted - 2004-07-02 : 13:01:57
Use Disconnected Edit on the package...
You'll see the Connections option, then
Microsoft Excel 97-2000 (That's what I'm using) then
OLE DB Properties then
Extended Properties
The Value has the string Excel 8.0;HDR=YES;
change it to be Excel 8.0;HDR=NO;

Then you can change the query to something like:

Select * from [Sheet1$]

The rows should be returned with column headings of F1, F2, F3.. etc
Go to Top of Page

jsiedliski
Yak Posting Veteran

61 Posts

Posted - 2004-07-02 : 16:22:26
Thank you very much. I was poking around in the Disconnected Edit section, but I did not find the solution until you told me where to look.

Thanks again,

Jack

:)
Go to Top of Page
   

- Advertisement -