New training course: Customizing SQL Prompt. Watch now.

DELETE statement and Catastrophic Failure in SQL Server Management Studio V17.6

simonwsimonw Posts: 4 New member
edited April 25, 2018 9:58PM in SQL Prompt
SSMS V17.6
Windows 7 64Bit
SQL Prompt

This is more of an interesting case, rather than something that needs to be fixed right away.  It's been doing it to me for a while now, so I'm not in any rush to get it fixed.
The scenario is this:
I have a custom snippet that I use almost daily to delete users that no longer are required in a particular table.  I type "dels" + tab and SQL Prompt generates my delete statement that contains 1 placeholder.  After sql prompt creates my statement, I then paste the value of my placeholder in and run the statement.  Sometimes records exist, sometimes they don't, doesn't matter.

Here is the bug part. 
If I do not hit enter after I put in my placeholder value - a black box continues to surround the placeholder value I have entered.  Then if I modify the "(0 affected records)" output text in the bottom pane (messages section) of the query page and hit F5 to run the statement again - I get a catastrophic failure error message

TITLE: Microsoft SQL Server Management Studio
Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)) (Microsoft.VisualStudio.OLE.Interop)

Here is the trace as well
   at Microsoft.VisualStudio.OLE.Interop.IOleUndoManager.Enable(Int32 fEnable)
   at Microsoft.SqlServer.Management.UI.VSIntegration.ShellTextBuffer.set_UndoEnabled(Boolean value)
   at Microsoft.SqlServer.Management.UI.VSIntegration.ShellTextBuffer.Clear()
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VSTextEditorTabPage.Clear()
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.DisplaySQLResultsControl.Clear()
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.DisplaySQLResultsControl.PrepareForExecution(Boolean prepareForParse)
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptAndResultsEditorControl.StandardPrepareBeforeExecute(QEStatusBarKnownStates newStatusBarState)
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.SqlScriptEditorControl.StandardPrepareBeforeExecute(QEStatusBarKnownStates newStatusBarState)
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ScriptAndResultsEditorControl.OnExecScript(Object sender, EventArgs a)



  • SweetChaiBoiSweetChaiBoi Posts: 1 New member
    I can reproduce this error. It always happens when:
    • You are still in "edit placeholder mode" (boxes visible around placeholders)
    • The content of the messages tab in the result window is changed to anything else than what was generated
    • You want to execute the query

    I reproduced it with a snippet containing "select $value$".
  • way0utwestway0utwest CO, USA Posts: 306 Rose Gold 1
    Why would you alter the messages pane? Is there some workflow that you do this often in?
  • simonwsimonw Posts: 4 New member
    That is a very valid question!
    I don't mean to alter it, I just need to copy the results and paste them into a ticket so I have a record of the number of records affected - but sometimes I hit a wrong key combination by mistake (instead of Ctrl+C - maybe just hit C without Ctrl all the way down) which overwrites the results.  That's how I got the error to begin with - rerunning the query after the result pane is changed.
  • way0utwestway0utwest CO, USA Posts: 306 Rose Gold 1
    That makes sense. I thought I might be missing some trick.

    I've never pasted or changed that pane, but I'm guessing that there's some type of strange event wired to it. Not sure we'll fix this, but I'll pass along the information.
  • simonwsimonw Posts: 4 New member
    Honestly it doesn't matter to me if you fix it or not - but it is an unhandled exception in your code that's being pushed to management studio to handle - and as a developer myself, I felt compelled to pass along the information.  
    Like I said in the original - it's an interesting case - not necessarily needing to be fixed right away.

Sign In or Register to comment.