2

I am debugging a stored procedure in Sql Server, I can see the local variables in "Locals", I can add other variables in "Watches" (I have embedded a picture here with Sql Server in debug mode and different debug windows). My question is: where can I see the result of the select statements during debugging? It is really helpful to see them as they are executed, more so when they read from temporary tables sometimes, which are local to that procedure. enter image description here

Later edit: I have followed the advice given below and am having this problem with XML viewer (please see attachment): "The XML page cannot be displayed" enter image description here

1
  • SQL Server Profiler allows you to debug queries, have you looked into this? Commented Nov 11, 2015 at 8:47

1 Answer 1

1

From View contents of table variables and temp tables in SSMS debugger:

This won't be in immediately, but we are considering a feature similar to this for a future release.

And workaround (you need to add additional XML variable for each temp table):

Declare @TableVar_xml xml
Set @TableVar_xml = (Select * from @TableVar for XML Auto, Elements xsinil);

Then I can look at the table variable contents using the XML viewer.

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

3 Comments

Thank you very much, lad2025! Unfortunately I receive an error: "The XML page cannot be displayed" (I have added the print screen in the original question). How do you use XML Viewer, can you please expand a little on this?
@JD123456 Try: Set @TableVar_xml = (Select * from @TableVar for XML Auto)
@JD123456 Does your @TableVar contain any rows?

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.