October 31, 2014 at 1:38 pm
I used code below to do bulk insert.
Since csv file first row is column name.
How to skip first row?
BULK
INSERT TEST
FROM 'c:\test.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = ''
)
GO
November 2, 2014 at 1:07 am
Quick suggestion, use the FIRSTROW = n, n = number of rows to skip
😎
November 2, 2014 at 6:51 am
Eirikur Eiriksson (11/2/2014)
Quick suggestion, use the FIRSTROW = n, n = number of rows to skip😎
Actually, the n is the number of the row to start with. If row 1 has the headers then you want n to be 2.
November 2, 2014 at 7:48 am
Lynn Pettis (11/2/2014)
Eirikur Eiriksson (11/2/2014)
Quick suggestion, use the FIRSTROW = n, n = number of rows to skip😎
Actually, the n is the number of the row to start with. If row 1 has the headers then you want n to be 2.
Good catch, thanks Lynn
😎
November 2, 2014 at 5:05 pm
Just be VERY aware that the rows you skip must have the exact same number and type of delimiters as the rows you want to import or you're in for missing some rows that you didn't want to miss.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply