开发者

Can we get estimated plan of a statement in SQL Server as a select query result set OR automate SSMS - display estimated plan command via .NET

Using SSMS for the following statement I can see the estimated plan using Display Estimated Plan command.

select * from adventtureworks.table1;

However if I need to get the estimated plan as a result set of select statement, what sql statements do I have to execute?

I need the result in xml format so that I can display in a .net app/ else is there a way to automate the SSMS Display Estimated Plan command via开发者_运维技巧 .NET?


You can retrieve the estimated execution plan with:

SET SHOWPLAN_XML ON

Note that with this option turned on, SQL is no longer executed. The plan to execute it is generated and returned.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜