top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Debug a Stored Procedure..!!

+4 votes
637 views

Is there any method to Debug a Stored Procedure step by step?

posted Apr 1, 2014 by Khusboo

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
I would strongly recommend you to read this post. I think you will find out your answers here.
http://www.diaryofaninja.com/blog/2010/11/23/debugging-sql-queries-function-amp-stored-procedures-with-sql-management-studio

1 Answer

+1 vote
 
Best answer

add an input parameter named @Debug = 0 (defaulted to 0 = off) at the end of the parameter list for the procedure.

then add if (@Debug = 1) print '...';

statements in the code at key junctures to display any useful internal values etc.

Yes, it's "old school" and debuggers that let you "walk the code" are great - but this works for anyone from any SQL tool (including anyone debugging without your same IDE).

answer Apr 22, 2014 by Divya Bharti
Similar Questions
+4 votes

How to Generic Method to Create and Execute Parameterized SQL Query in .NET 4.0 ?

+3 votes

What can be various Concurrency Issues in .NET one should take care of?

+10 votes

I want to retrieve some data from sql server to my application, and from there export some selected data to Excel!

...