SQL 11 (Code Name: “Denali”) – Debugging enhancements – Data Tips – Editing, exporting & importing


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:

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

Data Tips

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 image
To edit the value in a data-tip, click on the "value" area image

*For read-only variables, this will not be editable

Type in the required value image
Allow the execution to continue image

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”.

image

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.

Go to:

Debug –> Export Datatips
image
Save the DataTips as an XML file image
To Import, simply go to Debug –> Import DataTips and import the XML file image

Know more

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:

  1. Availability of DataTips & ability to pin/move them
  2. Creating conditional breakpoints & labeling them
  3. Searching for breakpoints based on their label
  4. “When Hit” do something
  5. Editing data within DataTips
  6. Preservation of DataTips after a debug session
  7. Export/Import of breakpoints & DataTips

What would be your ranking? Do let me know.

Until we meet next time,

Be courteous. Drive responsibly.

Advertisement

1 thought on “SQL 11 (Code Name: “Denali”) – Debugging enhancements – Data Tips – Editing, exporting & importing

  1. Pingback: #0382 – SQL Server – SSMS – Debugging a T-SQL DML Trigger | SQLTwins by Nakul Vachhrajani

Let me know what you think about this post by leaving your feedback here!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.