I’m here at the SQL Connections conference in April of 2008 and I’m giving a presentation on some of the new Manageability Improvements for SQL Server 2008. In this blog post I’ll talk about the Transact-SQL Debugger tool.
Those of you who have been using SQL Server for many years are probably already familiar with this improvement. In fact, you’re one of the reasons it is included in SQL Server 2008. See – we do listen!
A “Debugger” is simply a tool that helps you move through your code, line by line, showing you the current state of the variables in the program, an output window where you can observe what the code is doing, error windows, and the ability to navigate backward and forward through each line. The T-SQL debugger we’ve created does just that, and more.
You can set “breakpoints”, which means that you can place a mark by a certain line of code, and then tell the debugger to run the code up to that point and then stop.
Even if you’re not a hard-core T-SQL developer, you probably do write code from time to time. The De bugger is
included right on the main menu line, so you don’t have to launch anything special to run it. Just type some code (even a system stored procedure like sp_adduser will do) and select the Debugger menu item. The system will show a few more windows, but won’t appear to be doing anything – just click the icon in the icon bar that has the tip-text of “Step into” and watch the screen. Play around with the Step Over features, left-click next to a line of code to set a breakpoint, and generally experiment with the feature. It’s a great way to fix problems, and it’s even a useful way to learn!