Friday, April 10, 2009

SQL Debugging within Visual Studio

Today's revelation: You can debug SQL stored procedures and functions. OMG. I just saved a half hour of digging through code by stepping through the debugger to see where my code went wrong.

It is simple to do and described well here. I just fired up Visual Studio 2008, opened Server Explorer, and opened a Data Connection. I had to make sure the connection was using Windows authentication, and that my AD account was registered as a user with the sysadmin role on the server. That was true, so I then right-clicked and chose "Step Into Function". Voila! The debugger console came up, asked me for parameters, and showed my function. This is extremely useful.

Apparently I'm late to the game since I've read this has been around since SQL Server 2000!

No comments: