FIX: Execution of Stored Procedure That Uses a TEXT Parameter in Cursor Definition Causes AV (308398)
The information in this article applies to:
- Microsoft SQL Server 2000 (all editions)
This article was previously published under Q308398
BUG #: 354882 (SHILOH_BUGS)
SYMPTOMS
An access violation (AV) may be raised upon the execution of a stored procedure that has the following properties:
- The stored procedure receives a parameter of type TEXT.
- The TEXT parameter is used in the declaration of a cursor.
- The cursor declaration compares a table column of type char, varchar, or text with the TEXT parameter using the LIKE comparison operator.
RESOLUTIONTo 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
WORKAROUND
Modify the data type of the parameter to be CHAR or VARCHAR. This change prevents the access violation but limits the length of the parameter passed to the stored procedure to 8000 characters. For example:
CREATE PROCEDURE sp_reproduce (@TextPrm varchar(8000)) AS --make parameter varchar(8000)
BEGIN
DECLARE CheckDupText CURSOR DYNAMIC
FOR
SELECT Col1 FROM Test WHERE Col2 LIKE @TextPrm
END
NOTE: See the "Steps to Reproduce Behavior" section for additional information relevant to this example.
STATUSMicrosoft 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.
Modification Type: | Major | Last Reviewed: | 10/3/2003 |
---|
Keywords: | kbbug kbfix KB308398 |
---|
|