title: Creating a 'NOT NULL' SQLite column without specifying a default value
body: <p>I am trying to create an SQLite database from within a C# WinForms application. I am using the <code>System.Data.SQLite</code> library <a href="http://www.sqlite.org/download.html" rel="noreferrer">as found on sqlite.org</a></p>
  
  <p>I can create the database fine, and I can create tables fine too. The problem comes when I need to add a new column where I don't want to allow nulls, but I don't want to specify a default value either.</p>
  
  <p>For creating a table I would use a query such as this:</p>
  
  <pre><code>CREATE TABLE MyTable (ID INTEGER PRIMARY KEY AUTOINCREMENT)
  </code></pre>
  
  <p>The problem occurs when I then run this query:</p>
  
  <pre><code>ALTER TABLE MyTable ADD COLUMN Col1 nvarchar NOT NULL
  </code></pre>
  
  <p>This is producing the following error:</p>
  
  <blockquote>
    <p>SQL logic error or missing database  Cannot add a NOT NULL column with
    default value NULL</p>
  </blockquote>
  
  <p>I understand why this might be a problem if the tables contained data, but all the tables are empty (they have only just been created).</p>
  
  <p>I am also able to manually add the NOT NULL columns without defaults to the database using a separate tool (SQLiteStudio).</p>
  
  <p>So why am I not able to do this? Is there something wrong with my query?</p>