title: Sybase ASE: Add NOT NULL column without a DEFAULT fails. Why?
body: <p>Consider the following empty (as in without rows) table:</p>
  
  <pre><code>CREATE TABLE my_table(
      my_column CHAR(10) NOT NULL
  );
  </code></pre>
  
  <p>Trying to add a NOT NULL column without a DEFAULT will fail:</p>
  
  <pre><code>ALTER TABLE my_table ADD my_new_column CHAR(10) NOT NULL;
  
  Error:
  
  *[Code: 4997, SQL State: S1000]
  ALTER TABLE my_table failed. 
  Default clause is required in order to add non-NULL column 'my_new_column'.
  </code></pre>
  
  <p>But adding the column as NULL and then change it to be NOT NULL will work:</p>
  
  <pre><code>ALTER TABLE my_table ADD my_new_column CHAR(10) NULL;
  ALTER TABLE my_table MODIFY my_new_column CHAR(10) NOT NULL;
  </code></pre>
  
  <p>Setting a default and then removing the default will work too:</p>
  
  <pre><code>ALTER TABLE my_table ADD my_new_column CHAR(10) DEFAULT '' NOT NULL;
  ALTER TABLE my_table REPLACE my_new_column DEFAULT NULL;
  </code></pre>
  
  <p>What's the justification for this behavior? What is the database trying to do internally that adding the column directly fails? I have a feeling that it might have something to do with internal versioning but I can't find anything in this regard.</p>