BUG: SQL Server May Stop Without Any Information by BULK INSERT

ID: Q249119


The information in this article applies to:
  • Microsoft SQL Server version 7.0

BUG #: 56117 (SQLBUG_70)

SYMPTOMS

If all of the following conditions are true, executing a Transact-SQL BULK INSERT may cause the SQL Server to stop responding or cause a stack overflow or access violation (AV):

  • A table has an int data type field and some other data type fields. At least one field follows the int data type field.


  • A format file is used.


  • The field is defined as the fixed data length in the format file.


  • Only the space character is in the data file.


If SQL Server stops responding, you must restart SQL Server. This problem does not occur in the bulk copy program (BCP) utility.


WORKAROUND

To work around this problem, do any one of the following:

  • Make sure a value other than the space character is specified in the data file.

    -or-


  • Use the field terminator in the data file and format file.

    -or-


  • Use the BCP utility instead of BULK INSERT.



STATUS

Microsoft has confirmed this to be a problem in SQL Server version 7.0.


MORE INFORMATION

Steps to Reproduce the Problem

The following is a case where SQL Server may stop responding without any information:
  1. Create a data file named Test1.txt containing only two space characters and a <CRLF>.


  2. Create a format file named Test1.fmt containing the following:


  3. 
       7.0
       2
       1       SQLCHAR       0       1       ""                        1     c1
       2       SQLCHAR       0       1       "\r\n"                    2     c2 
  4. Execute the following script with Query Analyzer; SQL Server may stop responding without any information:
    
    use tempdb
    GO
    
    create table test (
     [c1] [int],
     [c2] [char] (1)
    ) ON [PRIMARY]
    GO
    
    BULK INSERT test FROM 'c:\test1.txt'
    WITH (FORMATFILE='c:\test1.fmt')
    GO 
    At this time, no information is recorded in the error log.


The following is a case where the stack overflow (or AV) happens:
  1. Create a data file named Test2.txt containing 13 space characters and a <CRLF>.


  2. Create a format file named Test2.fmt containing the following:


  3. 
       7.0
       2
       1       SQLCHAR       0       12      ""                        1     c1
       2       SQLCHAR       0       1       "\r\n"                    2     c2 
  4. Execute the following script with Query Analyzer; and the stack overflow or AV occurs:
    
    use tempdb
    GO
    
    create table test (
     [c1] [int],
     [c2] [char] (1)
    ) ON [PRIMARY]
    GO
    
    BULK INSERT test FROM 'c:\test2.txt'
    WITH (FORMATFILE='c:\test2.fmt')
    GO 


Additional query words: errorlog

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


Last Reviewed: January 28, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.