Is there a way to add OPTION (RECOMPILE) in C# while executing stored procedure by System.Data.SqlClient?
What I'm looking for in my imagination would be something like
using (SqlConnection sqlConn = new SqlConnection(CONN_STR))
{
sqlConn.Open();
using (SqlCommand cmd = new SqlCommand("usp_xyz OPTION (RECOMPILE)", sqlConn))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("x", x);
cmd.ExecuteNonQuery();
}
}