2
votes

I am trying to save a view in sql-server management studio which brings the following error message

Attempted to read or write protected memory. This is often an indication that other memory is corrupt

The same query works fine if I run it separately.

The full error message is below

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

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

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

   at Microsoft.SqlServer.Management.DataTools.Interop.IDTDocTool.Save(Object dsRef, String path, Boolean okToOverwrite)
   at Microsoft.SqlServer.Management.UI.VSIntegration.Editors.ViewDesignerNode.Save(VSSAVEFLAGS dwSave, String strSilentSaveAsName, IVsUIShell pIVsUIShell, IntPtr punkDocDataIntPtr, String& strMkDocumentNew, Int32& pfCanceled)

I am not sure where to look at

2
Tried restarting management studio? - Martin Smith
Yes, I did couple of times but the same result. If I click the execute sql option, SSMS get crashed. It says APPCRASH - huMpty duMpty
Quite a few of these on Connect. Top voted one indicates that a conflicting VS install might be to blame. Though others were product bugs - Martin Smith
@MartinSmith: Thanks Martin, its definitely something to do with designer. I tried creating the view using CREATE VIEW ViewName AS ... which created it - huMpty duMpty

2 Answers

0
votes

I got the same error message a few days back working on some reports on BIDS and strangely enough just resetting the windows layout fixed the issue. Because I had Solution Explorer sitting on a separate monitor.

While I was looking for a solution for this problem online I came across cases where people were getting this error message because of the other software installed on their machine.

There is no One reason for this error but hopefully this is a good place to start from. resetting the windows layout can you believe this :)

Question I asked a few weeks ago and didnt get any answers see here

0
votes

I also faced same error message while trying to edit top rows. But manual query works fine.

enter image description here

Reason behind:

  1. I already installed SQL Server Management 2012.
  2. Then i installed SQL Server Management 2018.
  3. I opened SSMS from 2012 where we faced the above mentioned issue.
  4. Later opened SSMS 2018, then problem got rectified.