Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Monday, December 15, 2014 5:46 PM
Hi,
I have a csv file that has some header information on the 1st row and then some garbage data after that. Is there a way to tell SSIS that I only want to import the first row and disregard the rest of the rows in the file?
thanks
Scott
All replies (5)
Monday, December 15, 2014 5:54 PM ✅Answered
Can you refer this link
http://sqlage.blogspot.com/2013/07/ssis-how-to-read-first-row-from-flat.html
--Prashanth
Monday, December 15, 2014 7:34 PM ✅Answered | 1 vote
You can use BULK insert inside an Execute SQL Task in your package to import the first row into your target table. Here is an example:
BULK INSERT [test1].[dbo].address_with_header
FROM 'C:\temp\Alist20141215.txt'
WITH
(
FIELDTERMINATOR ='\t',
FirstRow=1,
LastRow=1
);
Monday, December 15, 2014 5:59 PM
If you are importing data from the management studio import .export wizard, you can choose rows to skip. Haven't seem the same feature in SSIS tasks.
Monday, December 15, 2014 6:01 PM
Refer below: (Replace Generate Records (Script component task) with your Flat File Soruce:
-Vaibhav Chaudhari
Tuesday, December 16, 2014 3:29 AM
thanks Prashanth,
this should do the trick.