THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

John Paul Cook

How to Create Effective Error Reports

This post demonstrates some generic problem reporting steps that I encourage all users, whether developers or nontechnical end users, to follow. SQL Server has a feature that can help. So does Windows in some cases. More on those in Step 3.

Step 1: Is the problem caused by a particular action undertaken on a gui? If so, you should get a screen capture. But if it is caused by executing some T-SQL code in a query window, just copy/paste the offending code as text.

There are several ways to get a screen capture without purchasing a commercial screen capture product. The most appropriate method depends on the circumstances.

  1. If you just need to get a section of the screen, the Windows 7 Snipping Tool can easily and quickly grab a portion of the screen.
  2. If you need to capture what the screen looks like with cascading menus showing, you’ll need to press the Prt Scr button and capture the entire screen.
  3. If you need only a particular window and you’re on a version of Windows that doesn’t have the Snipping Tool, set focus to the window of interest and press Alt Prt Scr. In other words, hold down the Alt button before pressing the Prt Scr button. You’ll capture only the active window. The disadvantage is that any cascading menus will not be captured.

Get a screen capture showing what action causes the error to occur. A large percentage of end users press the Prt Scr button to get a screen capture, which is helpful, but creates an unnecessarily large image. Use Alt Prt Scr instead to capture only the active window instead of the entire screen. Hold down the Alt button before pressing the Prt Scr button. It’s advisable to make the active window as small as possible before capturing it. If your problem is caused only by executing code, a screen capture isn’t necessary. You can just provide the sample code

Step 2: Consider pasting the screen capture into Paint. There are several considerations:

  1. Does the screen capture contain private, personal information not relevant to the technical problem? If so, it must be removed or obscured.
  2. Does the screen capture contain a lot of information not really relevant to the actual problem, such as from Prt Scr that captured the entire screen? If so, consider selecting a subset of the image that still retains sufficient context.
  3. If, for example, clicking a specific button causes the error to occur, it’s best to clearly annotate the screen capture to indicate which button causes the error. A textual description accompanying the screen capture isn’t as convenient as having an annotated screen capture.
  4. Sometimes it takes more than one screen capture to establish a context.

Step 3: Capture the error message. This is where SQL Server can really help. Many times end users and even developers will send me a screen capture of the entire screen. Not good, particularly when it comes from a 2560x1600 30” monitor! Developers usually are better about this and use Alt Prt Scr to send something that looks like this:


While this is helpful, it isn’t optimal. Much of the time I’m going to end up manually transcribing the error message text into a search engine. It’s not necessary for me to do this when I’m provided a textual version of the error message. Both SSMS and Visual Studio provide a means to copy the error message as text. Take a closer look at the lower left corner of the SSMS error dialog box:


Clicking the icon in the lower left corner captures the contents of the error dialog as text. Here is the textual version of the error dialog:

TITLE: Microsoft SQL Server Management Studio

The Database Engine service could not resolve the specified file location. Either the location does not exist, or the current login account does not  have access to it. Verify that the file location exists, and that the login account has permissions on it.



That’s what I want to receive instead of a screen capture. People who should know better don’t always do this even when they can. But what about the times when the Copy message text icon doesn’t appear? Sometimes Windows allows you to capture the contents of a dialog box (it doesn’t have to be an error dialog box, it could be a normal dialog box) even if there isn’t an icon to do so. The first trick is to set focus to the dialog box and use Ctrl-C to capture the textual contents of the dialog box. If it doesn’t work, you move on to the next trick. The next trick is to set focus to the dialog box and use Shift Ctrl-C to capture the textual contents of the dialog box. When either of these tricks work, it’s quite handy. I've seen both techniques work as desired and other times not. If Ctrl-C captures the dialog box as an image, try Shift-Ctrl-C to hopefully capture the textual contents of the dialog box. There isn't one technique that always works, but I have succeeded in capturing the contents of error dialog boxes most of the time.

Published Saturday, March 19, 2011 11:48 AM by John Paul Cook

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS



Ed Zerylnick said:

Thanks - helpful!  While I knew most of this, there are a couple of tips I was not aware of.  Appreciate it.

March 23, 2011 10:40 PM

LosManos said:

There is no need for ctrl-shift-c for copying a message box.  The ordinary ctrl-c does fine.

April 11, 2011 4:49 PM

John Paul Cook said:

Ctrl-C sometimes copies the text containing within a dialog box. Sometimes it doesn't. When it doesn't, Shift-Ctrl-C may work. I've been able to capture the text contained in a dialog box in most Windows applications, but not from any Java applications.

April 20, 2011 12:38 PM

Leave a Comment


About John Paul Cook

John Paul Cook is a database and Azure specialist in Houston. He previously worked as a Data Platform Solution Architect in Microsoft's Houston office. Prior to joining Microsoft, he was a SQL Server MVP. He is experienced in SQL Server and Oracle database application design, development, and implementation. He has spoken at many conferences including Microsoft TechEd and the SQL PASS Summit. He has worked in oil and gas, financial, manufacturing, and healthcare industries. John is also a Registered Nurse currently studying to be a psychiatric nurse practitioner. Contributing author to SQL Server MVP Deep Dives and SQL Server MVP Deep Dives Volume 2. Connect on LinkedIn

This Blog



Privacy Statement