BUG: Default of @@DBTS Causes Access Violation When Using BCP

ID: Q136371


The information in this article applies to:

BUG# NT: 11327 (4.21a)

SYMPTOMS

When you use use @@DBTS as a default bound to a column that is defined as varbinary (8), the server receives an access violation:

Msg 0, level 19, state 0: Server <server name>, line 1: language_exec:
process 9 generated access violation; SQL Server is terminating this
process Operating-system error: ConnectionWrite(WriteFile()).
DB-LIBRARY error: possible network error: error in sending
out-of-band data to SQL server Connection broken" when attempting to
BCP data in.


WORKAROUND


STATUS

Microsoft has confirmed this to be a problem in SQL Server versions 4.21a and 6.0. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


MORE INFORMATION

The following script causes a handled access violation in SQL Server version 6.0:

  1. Set the database to pubs.
     
      create table testbcp (dt binary (8), str1 char (10), str2 char (10))
      go
      create default dtdef as @@DBTS
      go
      sp_bindefault dtdef, "testbcp.dt"
      go
      use master
      go
      sp_dboption pubs, "select into/bulkcopy", true
      go
      use pubs
      go
      checkpoint
     


  2. create a data file called c:\data.dat similar to:
    
          row1col2,row1col3
    
          row2col2,row2col3
     

    and a format file called c:\data.fmt similar to the following:
    
       6.0
       3
       1   SQLCHAR   0   0   ""      1 dummy
       2   SQLCHAR   0   10   ","      2 str1
       3   SQLCHAR    0   10   "\r\n"            3 str2 



  3. BCP the data in by going to a command prompt and typing:
    bcp pubs..testbcp in c:\data.dat /f c:\format.fmt /Usa /P

    Immediately after executing the bcp command, the server receives an access violation.


Additional query words: SQL6 av


Keywords          : kbprg SSrvProg kbbug4.21a kbbug6.00 
Version           : 4.21a 6.0
Platform          : WINDOWS 
Issue type        : 

Last Reviewed: April 19, 1999