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

Erwin Pombett
Erwin Pombett used Ask the Experts™
on
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.

toshi
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Mark WillsTopic Advisor, Page Editor
Distinguished Expert 2018

Commented:
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.
Topic Advisor, Page Editor
Distinguished Expert 2018
Commented:
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...

Author

Commented:
Thank you Mark !

toshi_
Mark WillsTopic Advisor, Page Editor
Distinguished Expert 2018

Commented:
A pleasure, and thank you very much for your question :)

Cheers,
Mark Wills

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial