title: Create automatically generated timestamp column in table?
body: <p>How to create a automatically generated timestamp column in table in Microsoft SQL Server 2019? Timestamp column should be automatically generated when I insert or update table.</p>
  <p>In IBM Db2 database the syntax is the following:</p>
  <pre class="lang-sql prettyprint-override"><code>    create table myschema.mytable (col1 int, col2 timestamp not null generated always for each row on update as row change timestamp
      insert into myschema.mytable (col1) values (1)
      update myschema.mytable set col1 = 2
  </code></pre>
  <p>After <code>insert</code>/<code>update</code> of column <code>col1</code>, column <code>col2</code> is automatically generated as current timestamp.</p>