You can use following DMVs to get the execution plan either XML format or graphical one.
USE AdventureWorks2008R2
EXEC [dbo].[uspGetEmployeeManagers] @BusinessEntityID=60
Note: I executed the SP first so that plan will be created. In actual environment this is not necessary.
select Plan_handle from sys.dm_exec_procedure_stats
ps
where ps.database_id=DB_ID('AdventureWorks2008R2')
and object_id=object_id('dbo.uspGetEmployeeManagers')
--Copy and paste the plan handle to the below query
select * from sys.dm_exec_query_plan(0x05000500EAE8807F40E13287000000000000000000000000)
Cheers for reading this blog post.
No comments:
Post a Comment