FIX: An Access Violation Occurs if an sp_cursoropen Call References a Parameter That Is Not Defined (810163)



The information in this article applies to:

  • Microsoft SQL Server 2000 Developer Edition
  • Microsoft SQL Server 2000 Standard Edition
  • Microsoft SQL Server 2000 Enterprise Edition
  • Microsoft SQL Server 2000 Personal Edition
  • Microsoft SQL Server 2000 Enterprise Evaluation Edition
  • Microsoft SQL Server 2000 Workgroup Edition
  • Microsoft SQL Server 2000 Desktop Engine (MSDE)
  • Microsoft SQL Server 2000 Developer Edition 64 bit
  • Microsoft SQL Server 2000 Enterprise Edition 64-bit

BUG #: 363090 (SHILOH_BUGS)

SYMPTOMS

If an sp_cursoropen call references a parameter that is not defined, the server raises a handled access violation in CExecParam::Init. The query may look similar to the following query:
exec sp_cursoropen @P1 output,
      N'SELECT * FROM tbl WHERE somecolumn = @P5',
      @P2 output, @P3 output, @P4 output
Note The query includes an @P5 parameter, but the type and value of the parameter are not provided.

The following stack is similar to the stack that is recorded in the SQL Server error log:
* Short Stack Dump
* 005DBD40 Module(sqlservr+001DBD40) (CExecParam::Init+00000006)
* 005DC162 Module(sqlservr+001DC162) (CParamExchange::InsertParam+0000001B)
* 00584715 Module(sqlservr+00184715) (CSPCursorOpenParams::CreateExecSqlPxp+0000016C)
* 00581FD0 Module(sqlservr+00181FD0) (SPCursor::Open+000000C6)
* 005E4CDE Module(sqlservr+001E4CDE) (CSpecProc::ExecuteSpecial+00000080)
* 005E49B6 Module(sqlservr+001E49B6) (CXProc::Execute+000000A3)
* 005E6BB4 Module(sqlservr+001E6BB4) (CSQLSource::Execute+0000037B)
* 00429DD3 Module(sqlservr+00029DD3) (execrpc+000004CB)
* 0042904D Module(sqlservr+0002904D) (execute_rpc+00000019)
* 00410FCE Module(sqlservr+00010FCE) (process_commands+00000210)
* 41073379 Module(UMS+00003379) (ProcessWorkRequests+0000024A)
* 41073071 Module(UMS+00003071) (ThreadStartRoutine+000000BD)
* 7800C9EB Module(MSVCRT+0000C9EB) (beginthread+000000CE)
* 77E96523 Module(KERNEL32+00016523) (TlsSetValue+00000115)
Note This stack is from Sqlservr.exe build 534.

RESOLUTION

Service pack information

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 How to obtain the latest SQL Server 2000 service pack

Hotfix information

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.

The following fix is hotfix build 701. It can only be applied to SQL Server 2000 Service Pack 2 (SP2).
   Date         Time   Version              Size  File name
   -------------------------------------------------------------------
   30-Aug-2002  21:08                    786,432  Distmdl.ldf
   30-Aug-2002  21:08                  2,359,296  Distmdl.mdf
   09-Oct-2002  00:54                        544  Drop_repl_hotfix.sql
   02-Jul-2002  15:35  2000.80.650.0     107,088  Impprov.dll      
   19-Jul-2002  16:56                    774,516  Instdist.sql
   08-Oct-2002  23:56                     12,615  Inst_repl_hotfix.sql
   20-Aug-2002  16:24  2000.80.679.0     111,172  Logread.exe      
   07-Apr-2002  02:08  2000.80.606.0      62,024  Odsole70.dll     
   03-Jan-2002  01:59                     18,185  Qfe356326.sql
   20-Aug-2002  16:47  2000.80.679.0     135,748  Qrdrsvc.exe      
   26-Aug-2002  22:49  2000.80.679.0     406,088  Rdistcom.dll     
   04-Oct-2001  01:36                    437,302  Replcom.sql
   20-Aug-2002  16:33  2000.80.679.0     152,136  Replmerg.exe     
   19-Nov-2001  20:36                    993,945  Replmerg.sql
   05-Nov-2002  23:48  2000.80.700.0     221,768  Replprov.dll     
   04-Oct-2001  01:36                    986,906  Replsys.sql
   04-Oct-2001  01:36                    881,228  Repltran.sql
   26-Aug-2002  22:49  2000.80.679.0     283,208  Rinitcom.dll     
   16-Sep-2002  22:31                    390,045  Securityhotfix.sql
   26-Aug-2002  22:49  2000.80.679.0      28,672  Sqlagent.dll     
   26-Aug-2002  18:39  2000.80.679.0     311,872  Sqlagent.exe     
   28-Aug-2002  16:32  2000.80.679.0      49,152  Sqlagent.rll
   26-Aug-2002  22:49  2000.80.679.0      53,824  Sqlcmdss.dll     
   28-Aug-2002  16:40  2000.80.679.0      12,288  Sqlcmdss.rll
   24-Oct-2002  17:37  2000.80.695.0     176,696  Sqlmap70.dll     
   08-Nov-2002  00:49  2000.80.701.0   7,471,188  Sqlservr.exe     
   01-Nov-2002  18:56  2000.80.698.0      45,644  Sqlvdi.dll       
   01-Nov-2002  18:00  2000.80.697.0      82,492  Ssnetlib.dll     
   07-Apr-2002  02:08  2000.80.606.0      70,208  Xplog70.dll      
   07-Apr-2002  02:08  2000.80.606.0      53,828  Xpqueue.dll      
   07-Apr-2002  02:08  2000.80.606.0     156,228  Xprepl.dll       
   12-Jul-2002  01:00  2000.80.658.0     279,104  Xpstar.dll       
   16-Sep-2002  23:12  2000.80.686.0      98,872  Xpweb70.dll

A separate fix (build 8.00.0765) that addresses this problem in SQL Server 2000 SP3 is available.
   Date         Time   Version              Size  File name
   -------------------------------------------------------------------
   08-Feb-2003  05:43                    786,432  Distmdl.ldf
   08-Feb-2003  05:43                  2,359,296  Distmdl.mdf
   30-Jan-2003  01:55                        180  Drop_repl_hotfix.sql
   01-Feb-2003  00:32  2000.80.763.0   1,557,052  Dtsui.dll        
   30-Jan-2003  05:18                    746,470  Instdist.sql
   30-Jan-2003  01:55                      1,402  Inst_repl_hotfix.sql
   08-Feb-2003  06:40  2000.80.765.0      90,692  Msgprox.dll      
   08-Feb-2003  03:53                  1,065,895  Replmerg.sql
   08-Feb-2003  06:40  2000.80.765.0     221,768  Replprov.dll     
   08-Feb-2003  06:40  2000.80.765.0     307,784  Replrec.dll      
   30-Jan-2003  05:18                  1,084,318  Replsys.sql
   08-Feb-2003  06:40  2000.80.765.0     176,696  Sqlmap70.dll     
   08-Feb-2003  06:40  2000.80.765.0      57,920  Sqlrepss.dll     
   08-Feb-2003  06:41  2000.80.765.0   7,528,529  Sqlservr.exe     
   08-Feb-2003  06:40  2000.80.765.0      45,644  Sqlvdi.dll       
   08-Feb-2003  06:40  2000.80.765.0      82,492  Ssnetlib.dll
Note Because of file dependencies, the most recent hotfix or feature that contains these files may also contain additional files.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.This problem was first corrected in Microsoft SQL Server 2000 Service Pack 4.

MORE INFORMATION

This problem only occurs with malformed queries. The fix for the problem is to throw an error that indicates that the sp_cursoropen call is not well formed, instead of causing an access violation.

Modification Type:MinorLast Reviewed:9/27/2005
Keywords:kbHotfixServer kbQFE kbQFE kbSQLServ2000preSP4fix kbfix kbbug KB810163