I want to convert a SQL Server execution plan (sqlplan) to a graphics file so that it can be easily shown to others. I could not find a utility to convert a sqlplan file to an image file. Is there a utility that I missed that can be used to convert a sqlplan file to an image file?

I am also familiar with the idea of using CTRL-Print Screen to copy an image of a window to the paste buffer and then using a graphics utility like Microsoft Paint to save the image as a graphics file. However, It saves the entire window. I have noticed other posts here that manage to just show the execution plan without anything else (like the SSMS clutter) and was wondering if there is an easy way to do that without editing the image.

| |
  • 6
    execution plan images never help because we can't hover over anything to get detail. Right click on the execution plan and save it as xml. then either post it here or uploaded it to pastebin.com – Scott Hodgin Aug 24 '16 at 16:34
  • 2
    @BobBryan use the snipping tool! support.microsoft.com/en-us/help/13776/… – vercelli Aug 24 '16 at 16:45
  • 1
    I normally just print screen and then edit in snagit. The image upload allows you to CTRL+V to paste an image from the clipboard so there is no need to even save a file and upload it. – Martin Smith Aug 24 '16 at 16:46
  • 1
    You can convert the XML output to a HTML with images: github.com/JustinPealing/html-query-plan but I too prefer the output of SET SHOWPLAN_ALL ON – a_horse_with_no_name Sep 1 '16 at 8:46
  • For the image, I did the following convoluted pathway recently. File->Print in SMSS. Set printer to MS XPS Document Writer and output to landscape (also in the Property->Advanced settings dialogue I set the page size to E size sheet). Then in my right-click context menu I have an option to convert to Adobe PDF. I did that. Then I opened the PDF in GIMP2, in Image or Layer->autocrop and File->Export As a GIF. – mpag Sep 1 '16 at 19:09
  • @ScottHodgin thanks for the tip re: pastebin. I recently couldn't paste my XML here at dba.se because that made my post over the character limit. I assume pastebin would allow me to get around that limit. – mpag Sep 1 '16 at 19:13
  • hmm, it looks like the max paste size for the free pastebin is 500k, so i don't think that's going to help you. You might try doing some searches for pastbin alternatives that allow more space. – Scott Hodgin Sep 1 '16 at 19:28
  • I personally can host my XML files on my old undergrad dept's webserver, but I prefer solutions-at-large. I suppose google docs is probably an option. – mpag Sep 1 '16 at 20:08
  • 2
    If you're okay with spending a few bucks, Mladen Prajdić's SSMS Tools Pack can save execution plan images to the clipboard or a file with a right-click. (Among the many things it does. Not a shill, just a happy customer.) – kozloski Sep 2 '16 at 15:29

SQL SERVER generates the SQL PLANS as XML documents, so what you are looking at on your screen is actually an XML document parsed by SQL Server and put into that graphical component. Given the parser is not available outside, you cannot by any means create a JPEG out of this. There is simply NO PICTURE created here, just an XML file. You could either save the plan as Xml or .sqlplan, frankly they are both the same: XML files.

You could use some third-party solutions such as SQL SENTRY to view the plans pictorially. However, I don't think you'll invest into those programs just to see a graphical representation when you could just take a screenshot.

| |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .