Microsoft KB Archive/238455

From BetaArchive Wiki
Knowledge Base


Article ID: 238455

Article Last Modified on 3/14/2006



APPLIES TO

  • Microsoft SQL Server 7.0 Standard Edition



This article was previously published under Q238455

BUG #: 56148 (SQLBUG_70)

SYMPTOMS

The SQL Server ODBC Bulk Copy API doing file operations to import data can end with one or more Unexpected End Of File(EOF) errors if the file is 4 GB or larger and contains a NULL value to be imported.

The number of reported failures matches the number of maximum errors allowed for the BCP operation. The default value is 10 but it can be changed using the (-m) parameter of BCP.exe.

CAUSE

When checking to ensure the correct file position is maintained when a NULL is located, only the low-order doubleword of the file size is interrogated by the SQLSRV32.dll driver.

The low-order doubleword of the file size maintains the position within the given 4 GB segment of the file. Thus, if the file is 4 GB or larger the low-order doubleword is the number of bytes exceeding the boundary. The following four examples illustrate the low-order doubleword calculations.

(Total File Size) - (Closest 4GB boundary) = low-order doubleword

1.  5GB - 4GB = 1GB 
2.  7.5GB - 4GB = 3.5GB
3.  4GB 6 bytes - 4GB = 6 bytes
4.  17GB - 16GB = 1GB (low-order doubleword) and 3 as the high-order doubleword
                

The BCP check fails when the position you are currently reading exceeds the low-order doubleword boundary. The first example fails when the first NULL is encountered after importing 1 GB worth of data from the file. The second would be 3.5 and so forth.

WORKAROUND

Keep the file size under 4 GB in size.

NOTE: Using the BCP.exe option to control the first and last row to import on a file over 4GB in size does NOT avoid the issue. The file must remain smaller than 4GB in size.

STATUS

Microsoft has confirmed this to be a problem in SQL Server 7.0. This problem has been corrected in U.S. Service Pack 2 for Microsoft SQL Server 7.0. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

254561 INF: How to Obtain Service Pack 2 for Microsoft SQL Server 7.0 and Microsoft Data Engine (MSDE) 1.0


For more information, contact your primary support provider.

MORE INFORMATION

All files types (native, character, with format file) are affected if a NULL exists that is to be imported.

Keywords: kbhotfixserver kbqfe kbbug kbfix KB238455