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.
Author |
Topic |
collie
Constraint Violating Yak Guru
400 Posts |
Posted - 2009-09-21 : 17:00:32
|
Hi,I have to import the file in the attachment.I need to ignore the first few rows. I am only intested in the values starting from row 21 which should be the header row.How can i read only these rows (from 21) map these columns into a staging table?Thanks[url]http://c-haosher.com/file.xls[/url]Whisky-my beloved dog who died suddenly on the 29/06/06-I miss u so much. |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
YellowBug
Aged Yak Warrior
616 Posts |
Posted - 2009-09-21 : 18:35:55
|
You can import data from Excel using the OPENROWSET and select * from [sheet1$] method, without using SSIS. To specify a range, try "SELECT * FROM [Sheet1$A1:B10]"In SSIS, in the Excel source object, use 'SQL Command' as the 'Data Access Mode' , and build a query like:SELECT F4, F5, F6FROM [Spreadsheet$]WHERE (F4 <> 'TheHeaderFieldName')Or you could also try using the conditional split in SSIS to ignore the first few rows.A quick google found this: http://weblogs.asp.net/mikebosch/archive/2007/10/26/ssis-skipping-rows-and-stripping-subtotals.aspxAFAIK, BCP and BULK INSERT work with flat files only; not with *.XLS files.Please correct me - if this is no longer the case. |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|
|