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:29am

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:36am

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

Other recent topics Other recent topics