Debugging SQL Server Stored Procedure in SQL Server 2012
Microsoft keep giving powerful facility for debugging in SQL Server and SQL Server 2012 is no exception. I still remember days of SQL Server 6.5 and 7.0 where we didn’t have luxury of debugging which we have at the moment.
I can see many of .NET developer shift their interest in SQL Server and become TSQL Developer, they really miss debugging facility which they used to get in .NET for such as F11 (Step Into) and F10 (Step Over).
Well, there is nothing to miss because SQL Server do have this facility but people doesn’t know due to lack of knowledge.
We generally used to use F5 or “Execute” button in standard toolbar in SSMS to execute query/SP etc, have you ever looked or tried “Debug” button in standard toolbar right beside “execute” button?
I am executing one stored procedure with “Debug” button from the toolbar as opposed with “F5” or “Execute” button. Once I start debugging, I can use F11 (Step Into) and F10 (Step Over). Here is the windows I got while debugging where I can keep watch on variable’s value, call stack etc.
Reference: Ritesh Shah
Note: Microsoft Books online is a default reference of all articles.