Unable to Bulk Load - When you use the FIRSTROW and LASTROW parameters, the value for FIRSTROW cannot be greater than the value for LASTROW

Hi All we are getting the below error 

Msg 4880, Level 16, State 1, Line 1

Cannot bulk load. When you use the FIRSTROW and LASTROW parameters, the value for FIRSTROW cannot be greater than the value for LASTROW

we are setting FORSTROW to 2 and MAXROWS to 0  which seems valid from reading the docs. We have also removed the max rows and are still getting the same error? 

This is part of the code we are using

N'BULK INSERT ' + @tableName + '
FROM '''+ @fileName + 
N'''
WITH
(
MAXERRORS = 0,
FIRSTROW = 2,
LASTROW = ' + @maxRows + ',
FIELDTERMINATOR = ''' + @fieldTerminator + ''',
ROWTERMINATOR = ''\n''

Thanks

September 2nd, 2015 1:26am

After removing the lastrows variable from the statement completed successfully. 

Free Windows Admin Tool Kit Click here and download it now
September 2nd, 2015 2:33am

Hi growl,

Glad to heard that the issue had been solved and thanks for your sharing. It will be very beneficial for other community members who have similar questions.

Id like to mark this issue as "Answered". Please also feel free to unmark the issue, with any new findings or concerns you may have.

Regards,
Katherine Xiong

September 2nd, 2015 3:27am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics