Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 107
  • Last Modified:

Is it possible to debug a Store Procedure on MSSMS after a unitTest that calls it from VS ?

Hello everyone,

I know how to debug a storeProc in MSSMS by launching the sp call from mssms with a breakpoint in it.
I know how to debug  in VS.....

but i dont know how to use both at the same time :
Is it possible to launch debug for a unittest  that call a SP and have MSSMS that  take over with the debug  and get back to VS  ?
If it's possible how can i do that ? i would appreciate a recipe or a link to it.

thank you in advance.

  • 3
1 Solution
Mark WillsTopic AdvisorCommented:
My short answer is "Not Easily". Too many limitations, so never really explored.

My long answer is (what I have always done) to edit the stored procedure to write a log. Then go through the log after the event.

My humble answer is... Not as far as I have ever needed to (use edit and write log). But, according to https://support.microsoft.com/en-au/help/316549/how-to-debug-stored-procedures-in-visual-studio-.net seems like you can. See Option 2.

But will hang around to see what other experts have to offer.
Mark WillsTopic AdvisorCommented:
Oh, and in VS2010 you used to connect to Server Explorer but in more recent, you now connect to SQL Server using Sql Server Object Explorer.

There is a good example here : https://www.codeproject.com/articles/1079275/debug-stored-procedures-in-visual-studio-and-ssms 

Seems like I need to brush up a bit more :) Still has a few limitations though...
toshi_Author Commented:
Thank you Mark !

Mark WillsTopic AdvisorCommented:
A pleasure, and thank you very much for your question :)

Mark Wills

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now