SQL Server SSMS – Can’t Open View’s Design

sql serversql-server-2016ssmsview

I get this error message (that you can see below), when I try to open a view's design. It's not happening with tables, only with views and only when I try to see the design, so I'm able to retrieve the data from it, for example with a select query. I got this error since we moved the database to another virtual server. I tried on different computers with different Windows (7 and 10) and SSMS (2008, 2010, 2012, 2014) versions.

enter image description here

TITLE: Microsoft SQL Server Management Studio
------------------------------

Attempted to read or write protected memory. This is often an indication that other memory is corrupt. (Microsoft.VisualStudio.OLE.Interop)

------------------------------
BUTTONS:

OK

===================================

When I click on the details I am presented with the following information:

Attempted to read or write protected memory. This is often an indication that other memory is corrupt. (Microsoft.VisualStudio.OLE.Interop)

------------------------------
Program Location:

   at Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget.QueryStatus(Guid& pguidCmdGroup, UInt32 cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
   at Microsoft.VisualStudio.Platform.WindowManagement.DocumentObjectSite.QueryStatus(Guid& pguidCmdGroup, UInt32 cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
   at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.QueryStatus(Guid& pguidCmdGroup, UInt32 cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
   at Microsoft.Internal.VisualStudio.Shell.Interop.IVsTrackSelectionExPrivate.Register()
   at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ConnectSelectionContext()
   at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.Activate()
   at Microsoft.VisualStudio.Platform.WindowManagement.WindowManagerService.viewManager_ActiveViewChanged(Object sender, ActiveViewChangedEventArgs e)
   at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
   at Microsoft.VisualStudio.PlatformUI.ExtensionMethods.RaiseEvent[TEventArgs](EventHandler`1 eventHandler, Object source, TEventArgs args)
   at Microsoft.VisualStudio.PlatformUI.Shell.ViewManager.SetActiveView(View view, ActivationType type)
   at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.ShowInternal(ShowFlags showFlags)
   at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.b__26()
   at Microsoft.VisualStudio.ErrorHandler.CallWithCOMConvention(Func`1 method)
   at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.Show()
   at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.MarshalingWindowFrame.b__7a()
   at Microsoft.VisualStudio.Shell.ThreadHelper.Invoke[TResult](Func`1 method)
   at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.MarshalingWindowFrame.Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame.Show()
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VirtualProject.CreateDesigner(Urn origUrn, DocumentType editorType, DocumentOptions aeOptions, IManagedConnection con, String fileName)
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VirtualProject.Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ISqlVirtualProject.CreateDesigner(Urn origUrn, DocumentType editorType, DocumentOptions aeOptions, IManagedConnection con, String fileName)
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ISqlVirtualProject.CreateDesigner(Urn origUrn, DocumentType editorType, DocumentOptions aeOptions, IManagedConnection con, String fileName)
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDocumentMenuItem.CreateDesignerWindow(IManagedConnection mc, DocumentOptions options)
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDocumentMenuItem.InvokeDesigner(IManagedConnection connection)
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.VsDocumentMenuItem.Invoke()
   at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ToolsMenuItemBase.MenuInvokedHandler(Object sender, EventArgs args)

We have SSMS 2012 and 2014 installed on Windows 10 and a few older computers have SSMS 2010 and 2012 on Windows 7. All computers have Visual Studio 2015 installed. Unfortunately, due to company policy I'm not able to use newer version than SSMS 2014.

We use SQL Server 2016. (Version 13.0.4001.0; NT x64)

exec sp_helptext 'theView' works well.

Best Answer

Because you are using a newer version of SQL Server than SSMS, I recommend you install a SSMS of same version or later than the SQL Server. There is no guarantee that an older version of SSMS will work on a newer SQL Server, but the opposite should work. SSMS should be backward compatible but no guarantee to be future compatible.

I know this answer is not what you want to hear but like stated in How do I ask a good question?:

Keep an open mind

The answer to your question may not always be the one you wanted, but that doesn’t mean it is wrong. A conclusive answer isn’t always possible. When in doubt, ask people to cite their sources, or to explain how/where they learned something. Even if we don’t agree with you, or tell you exactly what you wanted to hear, remember: we’re just trying to help.