Sunday, March 25, 2012

Automatically run query plan.

Continued from
news://msnews.microsoft.com:119/OQ$48kjyHHA.3848@.TK2MSFTNGP03.phx.gbl
Charles Wang wrote:
> Is there a way to tell the SQL Server 2005 to automatically generate
> query plan for certain stored procedure (as they run on the
> production server)? (I know it's a bad idea, but still).
Basically some of the suggestions worked. In the SQL Profiler 2005, you
can tell it to actually display the plan of every query it runs
across. Under Performance, pick Showplan XML and then pick appropriate
choices under Stored Procedures (or pick them all). And now you are
getting real time execution plans.
Thanks.Hi Frank,
I looked through the original post and I found that I did not ask this
question:
> Is there a way to tell the SQL Server 2005 to automatically generate
> query plan for certain stored procedure (as they run on the
> production server)? (I know it's a bad idea, but still).
You may also check the orginal post via:
http://groups.google.com/group/micr...ver/browse_thre
ad/thread/18a8d47f969e889c/ec07eacb708d070f?lnk=st&q=%22Automatically+run+qu
ery+plan%22&rnum=1&hl=en#ec07eacb708d070f
Is it your current question? SQL Server 2005 will automatically generate
query plan for certain stored procedure when the stored procedure is
compiled. As Tibor mentioned, you can run:
SELECT *
FROM sys.dm_exec_cached_plans
CROSS APPLY sys.dm_exec_query_plan(plan_handle)
to check the execution plan.
During the stored procedure execution, you can use SQL Profiler as you
mentioned to check what the execution plan that your stored procedure is
using is.
I am not sure if I understand your question. If there is anything
misunderstanding, please feel free to point out. I am glad to work with you
for further research.
Best regards,
Charles Wang
Microsoft Online Community Support
========================================
=============
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
========================================
==============
This posting is provided "AS IS" with no warranties, and confers no rights.
========================================
==============|||Hi Frank,
I am interested in this issue. Would you mind letting me know the result of
the suggestions? If you need further assistance, feel free to let me know.
I will be more than happy to be of assistance.
Best regards,
Charles Wang
Microsoft Online Community Support
========================================
==============
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
========================================
==============
This posting is provided "AS IS" with no warranties, and confers no rights.
========================================
==============

No comments:

Post a Comment