title: Attempted to read or write protected memory-SQL
body: <p>I am trying to save a view in sql-server management studio which brings the following error message</p>
  
  <p><em>Attempted to read or write protected memory. This is often an indication that other memory is corrupt</em></p>
  
  <p>The same query works fine if I run it separately.</p>
  
  <p>The full error message is below </p>
  
  <pre><code>===================================
  
  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&amp; strMkDocumentNew, Int32&amp; pfCanceled)
  </code></pre>
  
  <p>I am not sure where to look at</p>