FIX: SELECT with Timestamp Column That Uses FOR XML AUTO May Fail with Stack Overflow or AV

Article translations Article translations
Article ID: 318045 - View products that this article applies to.
This article was previously published under Q318045
BUG #: 356642 (SHILOH_BUGS)
Expand all | Collapse all

SYMPTOMS

A SELECT query that includes a table with a timestamp column that uses the FOR XML AUTO clause may encounter a stack overflow exception or handled access violation (AV).

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
NOTE: The following hotfix was created before the release of Microsoft SQL Server 2000 Service Pack 3.

The English version of this fix should have the following file attributes or later:
   Date         Time    Version      Size       File name
   ---------------------------------------------------------
   12-FEB-2002  23:28   8.00.0578    7,269 KB   Sqlservr.exe
				
NOTE:Because of file dependencies, the most recent hotfix or feature that contains the files may also contain additional files.


WORKAROUND

To avoid this problem, cast the timestamp column to a bigint value. For instance, you can modify the sample code shown in the "More Information" section as follows:
SELECT 
ColA As 'ColA' , ColB As 'ColB', ColC As 'ColC', 
Convert(bigint,ColTS) As 'Col Timestamp' 
FROM TblA 
WHERE  ColA = 2536  
FOR XML AUTO
				

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 3.

MORE INFORMATION

The following code demonstrates the problem:
SELECT 
ColA As 'ColA' , ColB As 'ColB', ColC As 'ColC', 
ColTS as 'Col Timestamp' 
FROM TblA 
WHERE  ColA = 2536  
FOR XML AUTO
				
The stack dumper produces the following information for the stack overflow (on build 8.00.534):
2002-02-08 17:51:42.49 spid53    02/08/02 17:51:42 Stack Overflow Dump not possible - Exception c00000fd E at 0x0040AEFD
2002-02-08 17:51:42.51 spid53    Address=40aefd Exception Code = c00000fd
2002-02-08 17:51:42.52 spid53    eax=912dd604 ebx=2b74d53c ecx=2b6d2234 edx=2b74d53c
2002-02-08 17:51:42.54 spid53    esi=2b74d554 edi=2b74c28c eip=0040aefd esp=2b74c22c
2002-02-08 17:51:42.56 spid53    ebp=2b74c25c efl=00010282
2002-02-08 17:51:42.58 spid53    cs=1b ss=23 ds=23 es=23 fs=38 gs=0
2002-02-08 17:51:42.59 spid53    1: Return Address 0040AEFD
2002-02-08 17:51:42.60 spid53    2: Return Address 006AF01A
2002-02-08 17:51:42.61 spid53    3: Return Address 006585CB
2002-02-08 17:51:42.62 spid53    4: Return Address 006585A5
2002-02-08 17:51:42.64 spid53    5: Return Address 0065848A
2002-02-08 17:51:42.65 spid53    6: Return Address 006580EE
2002-02-08 17:51:42.66 spid53    7: Return Address 006569C0
2002-02-08 17:51:42.67 spid53    8: Return Address 006562BF
2002-02-08 17:51:42.69 spid53    9: Return Address 0065B6F6
2002-02-08 17:51:42.70 spid53    10: Return Address 0041A2A4
2002-02-08 17:51:42.71 spid53    11: Return Address 00419314
2002-02-08 17:51:42.72 spid53    12: Return Address 00432F55
2002-02-08 17:51:42.73 spid53    13: Return Address 0065AA90
2002-02-08 17:51:42.74 spid53    14: Return Address 0065A9DB
2002-02-08 17:51:42.76 spid53    15: Return Address 0040F403
2002-02-08 17:51:42.77 spid53    16: Return Address 0040EA95
2002-02-08 17:51:42.78 spid53    17: Return Address 00410159
2002-02-08 17:51:42.79 spid53    18: Return Address 0053C498
2002-02-08 17:51:42.80 spid53    19: Return Address 00411099
2002-02-08 17:51:42.81 spid53    20: Return Address 41073379
2002-02-08 17:51:42.83 spid53    SELECT ColA As 'ColA' , ColB As 'ColB', ColC As 'ColC', ColTS as 'Col Timestamp'  FROM TblA
2002-02-08 17:51:42.86 spid53    WHERE   ColA = 2536 
2002-02-08 17:51:42.88 spid53    FOR XML AUTO
2002-02-08 17:51:42.90 spid53    
2002-02-08 17:51:42.91 spid53    TotalPhysicalMemory = 267968512, AvailablePhysicalMemory = 76611584
2002-02-08 17:51:42.94 spid53    AvailableVirtualMemory = 1806966784, AvailablePagingFile = 438804480
2002-02-08 17:51:42.97 spid53    Error: 0, Severity: 19, State: 0
2002-02-08 17:51:42.97 spid53    language_exec: Process 53 generated an access violation. SQL Server is terminating this process..
				
Here is the short stack dump associated with the access violation (on build 8.00.534):
* Short Stack Dump
* 00691A53 Module(sqlservr+00291A53) (LWstrToI8+00000036)
* 006AB77A Module(sqlservr+002AB77A) (CXVariant::PerformConvertToI8+000002E3)
* 006AF01A Module(sqlservr+002AF01A) (CXVariant::ConvertToI8+00000050)
* 006585CB Module(sqlservr+002585CB) (CXMLBinExecContext::AddValueTyped+00000024)
* 006585A5 Module(sqlservr+002585A5) (CXMLExecContext::AddValue+000000B7)
* 0065848A Module(sqlservr+0025848A) (CXMLBinExecContext::AddAttribute+000000F9)
* 006580EE Module(sqlservr+002580EE) (CXMLExecContext::AddTagAndAttributes+00000194)
* 00656985 Module(sqlservr+00256985) (CXMLExecContext::AddAutoXMLRow+000001E3)
* 006562BF Module(sqlservr+002562BF) (CXMLExecContext::AddXMLRow+000003CB)
* 0065B6F6 Module(sqlservr+0025B6F6) (CValOdsXMLRow::SetDataX+0000003D)
* 0041A2A4 Module(sqlservr+0001A2A4) (SetDataWithPop+0000001C)
* 0041CBAC Module(sqlservr+0001CBAC) (CEs::GeneralEval+000000A4)
* 00419314 Module(sqlservr+00019314) (CStmtQuery::ErsqExecuteQuery+000003D7)
* 00432F55 Module(sqlservr+00032F55) (CStmtSelect::XretExecute+00000229)
* 0065AA90 Module(sqlservr+0025AA90) (CStmtXMLSelect::WrapExecute+0000001C)
* 0065A9DB Module(sqlservr+0025A9DB) (CStmtXMLSelect::XretExecute+0000005B)
* 0040F403 Module(sqlservr+0000F403) (CMsqlExecContext::ExecuteStmts+000002D9)
* 0040EA95 Module(sqlservr+0000EA95) (CMsqlExecContext::Execute+000001B6)
* 00410159 Module(sqlservr+00010159) (CSQLSource::Execute+00000331)
* 0053C498 Module(sqlservr+0013C498) (language_exec+000003E1)
* 00411099 Module(sqlservr+00011099) (process_commands+000000EC)
* 41073379 Module(UMS+00003379) (ProcessWorkRequests+0000024A)
* 41073071 Module(UMS+00003071) (ThreadStartRoutine+000000BD)
				

Properties

Article ID: 318045 - Last Review: September 27, 2005 - Revision: 4.2
APPLIES TO
  • Microsoft SQL Server 2000 Standard Edition
Keywords: 
kbhotfixserver kbqfe kbsqlserv2000sp3fix kbbug kbfix kbsqlserv2000presp3fix KB318045

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com