The debugger in the SQL Server Management Studio (SSMS) for the upcoming SQL 11 (“Denali”) is packed with exciting features.The new SSMS is a derivative of the VS2010 shell and therefore extends the same debugging experience (with the obvious differences related to technology) that it would deliver to let’s say a C# developer.
We have already discussed a couple of debugging enhancements. If you have missed any of them, or would like a refresher, please use the links below:
- Setting, Labeling, Using & Searching Conditional Breakpoints
- Export/Import Breakpoints
- “When Hit” do something
- An Introduction to Data Tips
We will be continuing the example that we used last time after a bit more simplification:
DECLARE @iCounter INT = 0 WHILE (@iCounter <= 20) BEGIN PRINT 'Hello World! The counter reads: ' + CAST(@iCounter AS VARCHAR(2)) SET @iCounter += 1 END GO
As I mentioned in my previous post, the Data Tips are a very light-weight version of the Watch window. They allow you to view the value of variable within the current scope by placing the mouse pointer over the given variable when in break/debug mode.
Editing data within a data-tip
One can change the value of a variable at runtime from within the watch window to force the debugger to use that value instead of the normally computed value. Because the Data tips are a light-weight version of the Watch window, editing data in a data-tip should be possible.
|Start a debug session|
|To edit the value in a data-tip, click on the "value" area||
*For read-only variables, this will not be editable
|Type in the required value|
|Allow the execution to continue|
Preservation of data tips after debug session is over
Let’s assume that after an hour or so of debugging, you identify a variable taking on an incorrect value, which you need to protect against. You stop the debugger, but forget to note down the offending value! Simply the thought of spending another hour debugging would give you a headache. Well, not if Data Tips are used. That’s because they hold the value even after the debugging session is over.
All you need to do is to hover the mouse over the “pin” icon in the indicator pane and you will see that the data-tip containing the value from the previous session opens up with a balloon help saying “Value from last debug session”.
Exporting & Importing Data Tips
Exporting & Importing Data tips is very similar to exporting & importing breakpoints. In fact, they even share the same limitation – upon import, the file path and name must be the same as it was when the export was performed.
Debug –> Export Datatips
|Save the DataTips as an XML file|
|To Import, simply go to Debug –> Import DataTips and import the XML file|
To know more about how to use DataTips, please refer the MSDN article – http://msdn.microsoft.com/en-us/library/ea46xwzd.aspx
My Ranking on the Debugger enhancements
The time has now come to arrange the debugger enhancements in order of my preference. So, here goes:
- Availability of DataTips & ability to pin/move them
- Creating conditional breakpoints & labeling them
- Searching for breakpoints based on their label
- “When Hit” do something
- Editing data within DataTips
- Preservation of DataTips after a debug session
- Export/Import of breakpoints & DataTips
What would be your ranking? Do let me know.
Until we meet next time,
Be courteous. Drive responsibly.