Microsoft KB Archive/157903

= FIX: Changes Lost When Changing Variable During Debugging =

Article ID: 157903

Article Last Modified on 10/15/2002

-

APPLIES TO


 * Microsoft Visual C++ 4.2 Enterprise Edition

-



This article was previously published under Q157903



SYMPTOMS
When you debug a SQL Server-stored procedure, if you change a variable or parameter to a value that is longer than the declared size of the variable or parameter, your changes will be lost without warning in the next step of the debugger.



CAUSE
Developer Studio accumulates all changes made to variables and parameters and then ships them across to SQL Server when the user moves to the next step. SQL Server may either accept or reject the changes. In this case, it rejects because of buffer overflow. MSDEV shows the valid values of the variables in the next step and ignores the invalid assignment that the user specified.



RESOLUTION
SQL Server will only accept changes that satisfy the declaration of the variable or parameter. MSDEV does not impose this limitation on values entered in the debugger. Therefore, just because the MSDEV accepted a value for a variable or parameter, do not conclude that that value will necessarily be the one that is used thereafter in the execution of the stored procedure. The deciding factor is whether SQL Server accepts the new value.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++, Enterprise Edition, version 5.0.



MORE INFORMATION
As an example of this behavior, if you have the following variable declaration in your stored procedure: declare @name varchar(10) select @name = 'Value' and you change "@name" to a value that is longer than 10 characters (using the watch window) while debugging, the changes will be accepted and MSDEV will show the new value in the watch window.

However, as soon as you step to the next statement, "@name" will revert to the value it had before you changed it.

Additional query words: kbVC420bug kbDSupport

Keywords: kbbug kbfix kbsqlprog kbide kbeedition kbvc500fix kbdebug KB157903

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.