1

I am importing Excel data to DB using SSIS package.

The problem is i want to consider second Row i.e A2:Z2 as column name.

I don't want to take A1:Z1 into consideration.

How can i achieve it.

My researched Link 1 Link 2

Community
  • 1
  • 1
Prahalad Gaggar
  • 11,389
  • 16
  • 53
  • 71

1 Answers1

9

I have a sample excel file with the data like

enter image description here

In excel source use SQL Command for Data access mode and write the query to skip the initial row

SELECT * FROM [Sheet1$A2:B]
--In your case it will be [Sheet1$A2:Z]

and in the excel connection manager select the option First Rows as Column name

enter image description here

When i try to preview it ,i get the data from the 2nd row onwards

enter image description here

praveen
  • 12,083
  • 1
  • 41
  • 49
  • I ain't getting option like **Data access mode**. I am getting **4** options i.e **Properties->Access Mode** `1.OpenRowSet 2.OpenRowSet From Variable 3.SQL command 4.SQL command From Variable`. I Used SQL Command but that didn't help. – Prahalad Gaggar Apr 19 '13 at 06:16
  • My apologies .i actually meant `SQL Command` in `Data access mode`.BTW r u getting any error ? can u post some sample data and don't forget to mark the `checkbox` to select `First Row as Column names` – praveen Apr 19 '13 at 06:18
  • I don't know I tried the same **First Time**, I got an **error** but now it's working Fine. Thanks for your help. – Prahalad Gaggar Apr 19 '13 at 06:35
  • Do you have to say WHERE ID IS NOT NULL? Or is this automatically handled? I am trying to understand how does ssis known which row to stop at? – variable Mar 19 '21 at 18:34