Using the QuickWatch Window

Feature Only in Enterprise Edition   SQL source code debugging is supported only in Visual C++ Enterprise Edition. For more information, see .

You can use QuickWatch to quickly examine the value of SQL variables and parameters. You can also use QuickWatch to modify the value of a local variable or to add a variable to the Watch window. You cannot modify the value of a global.

The QuickWatch dialog box contains a text box, where you can type a variable name, and a spreadsheet field that displays the current value of the variable that you specified.

The Current Value spreadsheet field displays only one variable at a time. Typing a new variable in the text box and pressing ENTER replaces the previous variable. QuickWatch displays SQL code variable values in their native format.

To view the value of a variable using QuickWatch

  1. Wait for the debugger to stop at a breakpoint.

    – or –

    From the Debug menu click Break to halt the debugger.

  2. From the Debug menu, click QuickWatch.

    The QuickWatch dialog box appears.

  3. Type or paste the variable name into the Expression text box.

  4. Click Recalculate.

  5. Click Close.

Tip   The Expression drop-down list box contains the most recently used QuickWatch variables.

To quickly view the value of a variable using QuickWatch

  1. When the debugger is stopped at a breakpoint, switch to a source window, and click the right mouse button on a variable (Var, for example).

  2. From the shortcut menu, click QuickWatchVar.

  3. Click Recalculate.

  4. Click Close.

When the program is paused at a breakpoint or between steps, you can change the value of any variable in your program. This gives you the flexibility to try out changes and see their results in real time or to recover from certain logic errors.

To modify the value of a variable using QuickWatch

  1. From the Debug menu, click QuickWatch.

  2. In the Expression text box, type the variable name.

  3. Click Recalculate.

  4. Use the TAB key to move to the value you want to modify.

  5. Type the new value, and then press ENTER.

  6. Click Close.

Note   Modified cached values may not take effect while you’re stepping through the SQL statement. Although you may have modified the value, it may never be checked again. There is no way to force a refresh.

To add a QuickWatch variable to the Watch window

  1. Use any of the procedures described previously to view the variable in the QuickWatch window.

  2. Click Add Watch.