Unanswered: proc execution plans, dynamic sql and a new one on me
new one on me. and i must be total ignorant hack or there is something else going on here. Someone just showed me a proc with some dynamic sql in it. The dynamic sql extracted from the proc by doing a print @SQL produces a exec plan different than anything in the stored procedure itself. They say it is because it is because dynamic sql is in a different @SPID, but then I threw this at them...
All they said was "Hmph". Their solution relies on the problem they can not see inexecution plan of the proc. What's doing?
ALTER PROC testSpid
DECLARE @SQL nvarchar(50)
SET @SQL = 'SELECT @@SPID'
exec sp_executesql @SQL
Last edited by Thrasymachus; 12-23-09 at 13:20.
If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry. Earnest Hemingway, A Farewell To Arms.