0

I'm debugging this code in Visual Studio:

INSERT INTO @transactions
SELECT FirstDate
FROM #coo

During debug, before this query is executed, I want to see what the result of the select statement will be.

I added a watch for SELECT FirstDate FROM #coo but it says

could not be evaluated

How can I see the result of the select statement before the result is inserted into @transactions?

David Klempfner
  • 8,700
  • 20
  • 73
  • 153

1 Answers1

2

Thanks to this answer I was able to come up with a work around (until someone can answer the question).

I put

DECLARE @beforeInsert XML = (SELECT * FROM @transactions FOR XML AUTO)

before the insert statement, and then I put this after:

DECLARE @afterInsert XML = (SELECT * FROM @transactions FOR XML AUTO)

That way I could view the value of @beforeInsert and @afterInsert during debug and look at the difference to work out what was inserted.

David Klempfner
  • 8,700
  • 20
  • 73
  • 153