Specify a Breakpoint Condition

Applies to: SQL Server

A breakpoint condition is a Transact-SQL expression that is evaluated by the debugger when the breakpoint is reached. If the condition is satisfied and any specified hit count reached, the debugger either breaks or performs the action specified for the breakpoint.

This feature works with SSMS version 17.9.1 and earlier.

Specifying Conditions

The expression specified must be a valid Transact-SQL expression that evaluates to a Boolean value. For more information, see Expressions (Transact-SQL).

If you specify a breakpoint condition with invalid syntax, a warning message appears immediately. If you specify a condition with valid syntax but invalid semantics, a warning message is displayed the first time the breakpoint is hit. In either case, the debugger breaks execution when the invalid breakpoint is hit.

To Specify a Condition

  1. In the editor window, right-click the breakpoint glyph, and then click Condition on the shortcut menu.

    -or-

    In the Breakpoints window, right-click the breakpoint glyph, and then click Condition on the shortcut menu.

  2. In the Breakpoint Condition dialog box, enter a valid Boolean expression in the Condition box.

  3. Choose Is true if you want to break when the expression evaluates to true, or choose Has changed if you want to break when the value of the expression has changed.

    Note

    The debugger does not evaluate the Boolean expression until the first time the breakpoint is reached. If you choose Has changed, the debugger does not consider the first evaluation to be a change, so the debugger will not break on the first evaluation.

See Also