FIX: BULK INSERT Statement Inserts Records Into Table When FIRSTROW is Greater Than LASTROW

ID: Q225045


The information in this article applies to:

BUG #: 48052 (SQLBUG_70)

SYMPTOMS

The BULK INSERT statement inserts records into a table instead of returning an error when FIRSTROW is set to a value greater than LASTROW.


WORKAROUND

Set FIRSTROW to a value less than LASTROW.


STATUS

Microsoft has confirmed this to be a problem in SQL Server version 7.0. This problem has been corrected in U.S. Service Pack 1 for Microsoft SQL Server version 7.0. For information about downloading and installing the latest SQL Server Service Pack, see http://support.microsoft.com/support/sql/.

For more information, contact your primary support provider.


MORE INFORMATION

Steps to Reproduce the Behavior


CREATE TABLE bulk_t (c1 int)
GO

BULK INSERT bulk_t FROM 'C:\bulk_t.txt' WITH (firstrow=2, lastrow=1)
GO

-- bulk_t.txt is a text file with numbers 1 through 10 on each line

SELECT * FROM bulk_t
GO 
The fixed behavior in SQL Server 7.0 Service Pack 1 is that when the preceding BULK INSERT statement is executed, it runs successfully and the following message is returned:

   The command(s) completed successfully. 
However, no records are inserted into the table as none match the specified criteria.

Additional query words: bcp


Keywords          : kbbug7.00 kbSQLServ700bug kbSQLServ700sp1fix 
Version           : winnt:7.0
Platform          : winnt 
Issue type        : kbbug 

Last Reviewed: June 23, 1999