title: Correct query syntax for SQL DELETE via OPENQUERY to linked server
body: <p>I have a Linked Server I am attempting to access through vbscript, to perform a DELETE command. The current syntax for my query string is:</p>
  
  <pre><code>DBQUERY = "SELECT * FROM OPENQUERY(" &amp; strLinkedServer &amp; ", 
  'DELETE FROM pacts.acct_posting where posting_number = " &amp; intPostingNumber &amp; "');"
  </code></pre>
  
  <p>This gives a query string of:</p>
  
  <pre><code>SELECT * FROM OPENQUERY(PACTSTEST, 'DELETE FROM pacts.acct_posting 
  WHERE posting_number = 170026');
  </code></pre>
  
  <p>However this is returning the error:</p>
  
  <blockquote>
    <p>Cannot process the object "DELETE FROM pacts.acct_posting where
    posting_number = 170026". The OLE DB provider "MSDASQL" for linked
    server "PACTSTEST" indicates that either the object has no columns or
    the current user does not have permissions on that object.</p>
  </blockquote>
  
  <p>Permissions for accessing the Linked Server is not at issue.</p>
  
  <p>A quick Googling of the error message reveals a comment from MS that "OpenQuery requires a result set to be returned, but <code>UPDATE</code>, <code>DELETE</code>, and <code>INSERT</code> statements that are used with OpenQuery do not return a result set.". They provide some work-arounds, but as I'm not an SQL expert I don't understand the advice they give.</p>
  
  <p>This is at <a href="https://support.microsoft.com/en-us/kb/270119" rel="nofollow">https://support.microsoft.com/en-us/kb/270119</a></p>
  
  <p>Could somebody please advise me what I need to do given the advise at the linked page provided to make my query work?</p>