FIX: SQL Server May an Encounter Access Violation During a BULK IMPORT (308112)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q308112
BUG #: 354380 (SHILOH_BUGS)
BUG #: 354785 (SHILOH_BUGS)

SYMPTOMS

If you use a BULK INSERT to transfer data from a text file into a SQL Server database, SQL Server may encounter an access violation if the length of the data in the text data file does not match the related column's length in the destination database.

CAUSE

When the character set of the data file matches the character set of the server, no conversion is needed while transporting data from the text data file into the database. Under this condition, SQL Server trusts the data from the provider and does not check the length of the input data. If the input data length is greater than the related column length in SQL Server, a buffer overrun is possible, which leads to the server access violation.

RESOLUTION

To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

290211 INF: How to Obtain the Latest SQL Server 2000 Service Pack

Hotfix

NOTE: The following hotfix was created prior to Microsoft SQL Server 2000 Service Pack 2.

The English version of this fix should have the following file attributes or later:
   Version     File name       Platform
   -------------------------------------
   8.00.413    Sqlservr.exe    i386
				
NOTE: Due to file dependencies, the most recent hotfix or feature that contains the preceding files may also contain additional files.


WORKAROUND

To work around the problem, modify the input data file to make sure that the length of the source data matches the destination column's length.

STATUS

Microsoft has confirmed that this is a problem in Microsoft SQL Server 2000. This problem was first corrected in Microsoft SQL Server 2000 Service Pack 2.

MORE INFORMATION

In the RTM version of SQL Server 2000, the call stack looks similar to:
00412830 Module(sqlservr+00012830) (CQte::~CQte(void)+0000001F)
00460025 Module(sqlservr+00060025) (CQtePrjEl::`vector deleting destructor'(unsigned int)+0000000B)
00412832 Module(sqlservr+00012832) (CQte::~CQte(void)+00000022)
005332A0 Module(sqlservr+001332A0) (CXte::~CXte(void)+0000004D)
005332B9 Module(sqlservr+001332B9) (CXteRowCountSpool::`scalar deleting destructor'(unsigned int)+0000000B)
00412854 Module(sqlservr+00012854) (CQte::~CQte(void)+00000050)
005332A0 Module(sqlservr+001332A0) (CXte::~CXte(void)+0000004D)
00533357 Module(sqlservr+00133357) (CXteRowset::~CXteRowset(void)+00000057)
005339A7 Module(sqlservr+001339A7) (CXteUpdate::~CXteUpdate(void)+00000090)
0053390A Module(sqlservr+0013390A) (CXteUpdate::`vector deleting destructor'(unsigned int)+0000000B)
00462865 Module(sqlservr+00062865) (CQuery::~CQuery(void)+00000034)
00462785 Module(sqlservr+00062785) (CQuery::`vector deleting destructor'(unsigned int)+0000000B)
00533240 Module(sqlservr+00133240) (CStmtQuery::~CStmtQuery(void)+00000028)
00533204 Module(sqlservr+00133204) (CStmtXMLSelect::`scalar deleting destructor'(unsigned int)+0000000B)
0045D267 Module(sqlservr+0005D267) (CCompPlan::~CCompPlan(void)+00000034)
0045D21F Module(sqlservr+0005D21F) (CCompPlan::`scalar deleting destructor'(unsigned int)+0000000B)
004478DA Module(sqlservr+000478DA) (CCacheObject::Release(void)+000000EC)
0045D084 Module(sqlservr+0005D084) (CMsqlExecContext::~CMsqlExecContext(void)+00000133)
0045D00A Module(sqlservr+0005D00A) (CMsqlExecContext::`scalar deleting destructor'(unsigned int)+0000000B)
004478DA Module(sqlservr+000478DA) (CCacheObject::Release(void)+000000EC)
0040DD8F Module(sqlservr+0000DD8F) (CMsqlExecContext::Release(void)+00000020)
0045B66D Module(sqlservr+0005B66D) (CSQLStrings::~CSQLStrings(void)+00000084)
009262FC Module(sqlservr+005262FC) (ExecSql(class SQLError &,unsigned short *,unsigned int)+00000199)
00886DEF Module(sqlservr+00486DEF) (CBcpImport::ExecInsertStmt(unsigned long)+00000456)
				
-or-
00401F8A Module(sqlservr+00001F8A) (commondelete(void *)+00000017)             
004CDBFA Module(sqlservr+000CDBFA) (Bob::`vector deleting destructor' (unsigned int)+0000002B)                                                                 
004CDBBD Module(sqlservr+000CDBBD) (BobMgr::~BobMgr(void)+00000011)            
004CDAC0 Module(sqlservr+000CDAC0) (sort_clean(struct SORTDES * const,int) +00000122)                                                                          
004CD9D3 Module(sqlservr+000CD9D3) (RowsetSorted::DeleteSort(void)+00000071)   
004CD998 Module(sqlservr+000CD998) (SortSS::DeleteSort(void)+0000000F)         
004CD988 Module(sqlservr+000CD988) (CQScanSort::DestroySort(void)+0000000C)    
004CC99C Module(sqlservr+000CC99C) (CQScanSort::ChangeState(enum ESortState)+0000005F)                                                                        
004CEFD6 Module(sqlservr+000CEFD6) (CQScanSort::GetRow(unsigned long *,unsigned long *)+0000005A)                                                             
0047393C Module(sqlservr+0007393C) (CQScanUpdate::GetRow(unsigned long *,unsigned long *)+0000013D)                                                           
00433D03 Module(sqlservr+00033D03) (CQueryScan::GetRow(unsigned long *,unsigned long *)+00000014)                                                             
00433448 Module(sqlservr+00033448) (CStmtQuery::ErsqExecuteQuery(class CMsqlExecContext *,class CEsComp const *,class CEsComp const *,unsigned long *,int,int)const +0000040D)                                                               
0041EADE Module(sqlservr+0001EADE) (CStmtDML::XretExecuteNormal(class CMsqlExecContext *)const +000002F3)                                                     
0041E8D2 Module(sqlservr+0001E8D2) (CStmtDML::XretExecute(class CMsqlExecContext *)const +0000001C)                                                           
0040FCAD Module(sqlservr+0000FCAD) (CMsqlExecContext::ExecuteStmts(class ExecutionContext *)+0000027E)                                                        
0040F2D6 Module(sqlservr+0000F2D6) (CMsqlExecContext::Execute(class CCompPlan *,class CParamExchange *)+000001C7)                                             
0040EF81 Module(sqlservr+0000EF81) (CSQLSource::Execute(class CParamExchange *)+00000343)                                                                     
0056D2A2 Module(sqlservr+0016D2A2) (CSQLSource::SeExecute(void)+0000006D)      
009262E7 Module(sqlservr+005262E7) (ExecSql(class SQLError &,unsigned short *,unsigned int)+000000F1)                                                         
00886DEF Module(sqlservr+00486DEF) (CBcpImport::ExecInsertStmt(unsigned long)+00000456)                                                           
				

Modification Type:MajorLast Reviewed:10/9/2003
Keywords:kbbug kbfix kbSQLServ2000preSP2Fix KB308112