Click here to Skip to main content
15,614,270 members
Articles / Visual Studio / Visual Studio 2008
Technical Blog
Posted 18 Jan 2013

Tagged as


2 bookmarked

Stored Procedure Debugging in VS2008

Rate me:
Please Sign up or sign in to vote.
4.50/5 (2 votes)
18 Jan 2013CPOL2 min read
How to debug Stored Procedure in VS2008

Debugging is cool. I mean what would have been happened to developers if they couldn’t debug their code!! Speaking of myself at some point, I probably would’ve got pissed off and started to seek some other job. One reason I never was comfortable with database programming was that I was unable to debug the code. But since last year, I started to be cool about it while I found out this “Stored Procedure Debugging” thing. I know many developers still like SQL profiler but I always wanted to see what happens to the code line by line. Besides, the profiler actually has different features.

You’ll need Visual Studio 2008 Professional/Team System for enabling this feature. Express or Standard Editions aren’t going to work. And of course, you’ll need control over your SQL Server.

At first, establish a connection with the database to the project. You do that by choosing View->Server Explorer->Add Connection.


After you establish the connection, it's kinda look like this:


Right click on a procedure and open it. For this example I’m going to debug ‘spGetAcademicQualification’.


Now if you want to debug this proc, right click on the proc and click “Step Into Stored Procedure”.


A window will pop up and show you the parameters and let you put values on them. Then click the OK button to step into the procedure. The debugger will automatically stop execution on the first line of code in the stored procedure. When the debugger has stopped execution, you’ll see a yellow arrow to the left of the line of code just like VS debugger.

If you wonder what else works... I should tell you it seems to me its attitude is actually more likely the VS debugger. You can use break points. Things like Immediate Window, Quick Watch, Add Watch works in here. More importantly, you can view the parameters values. You can also edit them in their scope. There are several methods to do that. You can simply hover the mouse on them and change the values or do it in Watch window as you wish. Want to step into next line, try F10/F11 (C#).

Scroll below to see some images:





Image 9


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Software Developer (Senior)
Bangladesh Bangladesh
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

GeneralMy vote of 5 Pin
magicpapacy21-Jan-13 16:07
magicpapacy21-Jan-13 16:07 
Good Method!

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.