Search code examples
sql-serverdebuggingvisual-studio-2012stored-proceduresvisual-studio-debugging

SQL Server debug Stored Procedure from .NET code


I'm wondering if there's a way to debug a stored procedure at the time it's called from .NET code? What are my possibilities?

I'm using Visual Studio 2013 Community Edition and SQL Server 2014


Solution

  • I have managed to figure it out myself.

    It's quite similar to what you can find in VS 2010.

    1. I had to import database as a project to my solution.
    2. Turn on SQL Debugging in my application project properties.
    3. Re-open my project.
    4. Connect to my SQL Database through SQL Server Object Explorer.
    5. Right click on my SQL Server I connected to earlier and check "application debugging".
    6. Find SP I wanted to debug, double click on it, set my breakpoint (it says it will not be hit, but eventually it will).
    7. Launch my application using debugger.

    Everything now works as expected, the debugger stops at my breakpoint with no problem.