Can conditional breakpoints be set while debugging in SSMS?
I've just begun using breakpoints to debug a T-S开发者_如何学运维QL stored procedure in Management Studio (SQL Server 2008). I notice that the breakpoints window has a condition column:
But I can't find any way to actually specify a condition on a breakpoint, not via the Debug menu, not via a context menu on the breakpoint or within the breakpoint window, etc.
Is there a way to use conditional breakpoints in SSMS, or does that column exist for some future version?
No, they can't. From this site, you can see some of the other limitations also.
Here's the relevant quote:
The T-SQL debugger does not support the Microsoft Visual Studio features of setting breakpoint conditions or hit counts.
I have found a workaround:
in case my condition is @IterationNR = 18
I have stated
IF @IterationNR = 18
SET @IterationNR = @IterationNR
and set breakpoint to line with SET
command...
Another alternative would be to create a C# or VB .NET application that uses ADO .NET to execute the SQL query that you were executing on SQL Server Management Studio, and set the conditional or hit-count breakpoint within Visual Studio on the SqlCommand object.
精彩评论