The debugger of any IDE is a very powerful tool because it gives developers the insight on how their program or script is functioning. I have throughout been a SQL person, and have always felt that at some stage, Microsoft SQL Server did not deliver at par with it’s Visual Studio counterparts. This was despite the fact that the SQL Server Management Studio (SSMS) was a derivative of Visual Studio.
However, with the upcoming release of SQL 11 (“Denali”), I have no complaints. 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. The Visual Studio debugger provides a variety of tools for inspecting and modifying the state of a script. Obviously, these tools function only in break/debug mode.
We have recently been discussing about a couple of features related to Breakpoints. If you missed them or would like a refresher, you can click on the respective links below:
- Setting, Labeling, Using & Searching Conditional Breakpoints
- Export/Import Breakpoints
- “When Hit” do something
Today, we will be looking at something called “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
Data Tips
Per MSDN, “DataTips are one of the most convenient tools for viewing information about the variables and objects in your program during debugging. When the debugger is in break mode, you can view the value of a variable within the current scope by placing the mouse pointer over the variable in a source window.”
I like to think of it as a very light-weight version of the Watch window. When debugging, almost any troubleshooter likes to be in full control – knowing exactly what is going on where. If a variable changes it’s value, it might be important because it may not be warranted and might produce incorrect results. Data Tips help us in being “aware” about our surroundings, and at times, in controlling the flow of execution.
Please note that to the best of my knowledge, Data Tips are available in all the flavours of Visual Studio 2010.
To Display A Data Tip
Start a debug session | ![]() |
However the mouse over the variable to be evaluated, a Data Tip appears | ![]() |
To Move, Pin and Unpin A Data Tip
Click the “pin” icon | ![]() |
The data-tip is now “pinned” | ![]() |
Drag the data tip to the desired location to move it | ![]() |
Hover over the data-pin and click the “pin” icon again to un-pin the data-tip | ![]() |
Adding Comments to a Data Tip
Click the “Expand” arrow on the data-tip | ![]() |
Add required comments in the edit box | ![]() |
Click anywhere on the “Canvas” | ![]() |
To Close all Data Tips
We have not one, but 3 distinct options to clear out the data-tips on a Microsoft SQL Server Query Editor window.
Option #1 – Debug Menu | ![]() |
Option #2 – The Data tip itself | ![]() |
Option #3 – Right-click the “indicator” column | ![]() |
Later this week, we will see:
- Preservation of data tips after debug session is over
- Editing data in a data-tip
- Exporting & Importing data-tips
Finally, I will summarize which of the features I think I will be using the most once SQL 11 (“Denali”) hits production.
Until we meet next time,
Be courteous. Drive responsibly.
Great Data Tips Nakul, Here after I am going to follow your blog posts on Denali. Added to my RSS feed . Very clear and eay to understand. I am glad that I have learnt something new today.
LikeLike
Hello!
Hima: It is really wonderful to note that you liked my posts, and even exciting that you have added my posts to your RSS feed. I do hope to continue the trend of exploring and documenting the vast world of SQL Server in as simple words as possible.
Once again, thank-you very much for taking the time out to read my posts.
LikeLike
Pingback: #0382 – SQL Server – SSMS – Debugging a T-SQL DML Trigger | SQLTwins by Nakul Vachhrajani