User defined stored procedure - where's the execution plan?
3
votes
0
answers
151
views
SQL Server 2016, Enterprise Edition in Windows
Is there anyway to display the execution plan of a stored procedure created in C# with Visual Studio Data Tools? This is a question that someone with Visual Studio experience probably knows the answer to. My searches on Google haven't turned up anything useful.
Here is the stored procedure in c#
using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
public partial class StoredProcedures
{
[Microsoft.SqlServer.Server.SqlProcedure]
static public void Addition (SqlInt32 a1, SqlInt32 a2, out SqlInt32 sum)
{
sum = a1 + a2;
}
}
Here is the execution in SSMS 2017 v17.3
USE CLR1;
declare @sum int
exec dbo.Addition 3, 4, @sum output
select @sum
I have also been able to find the execution plan in cache. Even though there is a plan_handle available in dm_exec_procedure_stats, I can't seem to use a cross apply to [dm_exec_query_plan] to view it.
Asked by user4659
Oct 26, 2017, 10:04 AM
Last activity: Oct 27, 2017, 03:14 AM
Last activity: Oct 27, 2017, 03:14 AM