Specify a hit count
Applies to: SQL Server
A breakpoint hit count is a counter that the Transact-SQL debugger increments each time the breakpoint is reached. If the specified hit count is reached and any specified breakpoint condition is satisfied, the debugger performs the action specified for the breakpoint.
Hit count considerations
By default, execution breaks every time a breakpoint is hit. You can choose between the following options:
- Break always (the default)
- Break when the hit count equals a specified value
- Break when the hit count equals a multiple of a specified value
- Break when the hit count is greater than or equal to a specified value
Breakpoint hit counts are incremented within the scope of a debugging session. All hit counts are set to zero at the start of each debugging session.
To track the number of times a breakpoint is hit, without breaking execution, specify a hit count with a high value so the breakpoint never breaks.
The default action for a breakpoint is to break execution when both the hit count and breakpoint condition are satisfied. For information about specifying other actions, see Specify a breakpoint action.
Specify a hit count
In the editor window, right-click the breakpoint glyph, and then select Conditions... on the shortcut menu.
-or-
In the Breakpoints window, right-click the breakpoint glyph, and then select Settings on the shortcut menu.
Select the Conditions option, and select Hit count from the dropdown list.
Select the break option from the dropdown list: =, Is a multiple of, or >=.
Enter an integer to specify the hit count in the text box.
Select the behavior for when the hit count is reached.
Option Behavior Actions For more information, see Specify a breakpoint action. Disable breakpoint once hit Disables the breakpoint when the hit count is reached. Only enable when the following breakpoint is hit Select a defined breakpoint. Select Close to implement the changes.
View or reset the current hit count
In the editor window, right-click the breakpoint glyph, and then select Conditions... on the shortcut menu.
-or-
In the Breakpoints window, right-click the breakpoint glyph, and then select Settings on the shortcut menu.
Select the X to the right of the integer specified for the hit count to remove the configuration and set the current hit count to zero.
Select Close to implement the change.