Greetings. Im attempting to get the exec plan from a sproc that occasionally needs to be recompiled. However, as described in this article I'm unable to produce it, and a NULL is returned.
So I take the PowerShell method outlined in the article. It works for every other sproc I try, but for the sproc in question an empty file is output.
One interesting fun fact about this sproc is that the query below returns two values, each with a unique plan_handle value. Not sure that's the cause of my issue, but thought it worth mentioning.
So, does anyone know how I can get this plan?
SELECT * FROM sys.dm_exec_procedure_stats ps JOIN sys.objects o on ps.object_id = o.object_id WHERE o.name = 'mySproc'
TIA, ChrisRDBA