<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="ansi-diff-update">
      </a>
      1.7.2.2 UPDATE Differences
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045333263616">
  </a>
  <p>
   If you access a column from the table to be updated in an
          expression,
   <a class="link" href="update.html" title="15.2.17 UPDATE Statement">
    <code class="literal">
     UPDATE
    </code>
   </a>
   uses the
          current value of the column. The second assignment in the
          following statement sets
   <code class="literal">
    col2
   </code>
   to the
          current (updated)
   <code class="literal">
    col1
   </code>
   value, not the
          original
   <code class="literal">
    col1
   </code>
   value. The result is that
   <code class="literal">
    col1
   </code>
   and
   <code class="literal">
    col2
   </code>
   have the
          same value. This behavior differs from standard SQL.
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa98786685"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">UPDATE</span> t1 <span class="token keyword">SET</span> col1 <span class="token operator">=</span> col1 <span class="token operator">+</span> <span class="token number">1</span><span class="token punctuation">,</span> col2 <span class="token operator">=</span> col1<span class="token punctuation">;</span></code></pre>
  </div>
 </div>
 <br/>
</div>
