I am using the following Bulk command to insert data from a .CSV file into a SQL table - this is shipment details coming from a customer.
Bulk Insert SampleSQL
Fieldterminator = ',' ,
FIRSTROW = 2,
rowterminator = '\n'
This is working fine when I have data in the Sampleinput.csv file - however if no data is to be sent the user sends in a file and the second row says 'No product Shipped'
I then get this error when I bulk insert
Msg 4832, Level 16, State 1, Line 1
Bulk load: An unexpected end of file was encountered in the data file.
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.
Msg 7330, Level 16, State 2, Line 1
Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".
is it possible to put a clause into the Bulk insert that I can put into it that if the second row contains 'No product Shipped' then I can skip the Bulk insert in my program ?