0

In SQL server I can debug SP but I want to debug a local temporary SP( #SP ). Can any one tell me if it is possible and how should I do it?

And it is very good if I can debug it from the visual studio 2010.

Note that I am using SQL2008 express edition but if it work in other edition I can debug it at my work place.

4
  • Are you referring to a temp table in a stored procedure? Commented Aug 21, 2012 at 1:53
  • No I refer to a temp stored procedure, I want to debug a procedure that will be create local to each session. I have an SP that is temporary and created using CREATE PROCEDURE #SP Commented Aug 21, 2012 at 7:04
  • why are you not using functions instead of this temp stored procedure Commented Aug 21, 2012 at 8:54
  • first functions in SQL server can't do any thing, they can't do certain changes to database and second I have multiple programs that access to same database with one username and I don't want them to have access to my SP Commented Aug 21, 2012 at 9:52

1 Answer 1

1

You can have 2 instances of Visual Studio running, where one is debugging and stopped at a breakpoint after the temp SP is created and then from the other visual studio instance, refresh the list of SPs which should show your new temp SP. You can then start debugging that.

Sign up to request clarification or add additional context in comments.

2 Comments

temp SP like temp tables belong to sessions, so how another instance of visual studio see my temp SP?? it's name is added to tempdb.sys.objects and I can see it but can I put a break point on a name?? I need access to actual SP to be able to put my break point and I think it is not possible in second instance of VS or I don't know how to do it
yeah the session thing will be an issue. but what you can do is... (1) using only one instance of VS, (2) add two db connections in server explorer. one for your db and one to the tempdb (3) debug and stop at breakpoint after temp SP is created (4) refresh list of SPs in the tempdb connection. this should show your new temp SP. u can open this and add a breakpoint

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.